Luffy Learning City-python Development Training--Chapter II

Source: Internet
Author: User

12 binary, ASCII code, character encoding development

2 List

1) Create a list

2) Increase, delete, change, check

3) Slicing, looping, sorting

#!-*-coding = Utf-8-*-L1 = []Print(L1) L2= ['a','b','C','D','e','F']Print(L2) L3=list ()Print(L3)Print(Type (L3))#NestingLa = ['ABC',['a','b','C']]Print(LA)#Index, subscriptL4 = ['x','y','Z', 1,2,3,4,5,'e','R','g','h']Print(l4[2])Print(l4[-1])#slicesPrint(L4[:4])#Step SizePrint(L4[::2])#index value foundPrint(L4.index (3))#Add, append to last note each function adds a valueL4.append ('b')Print(L4)#InsertL4.insert (2,'Alibaba')Print(L4)#Modifyl4[2]='Tengxu'Print(L4)#continuous modification of several valuesl4[2:3]='Wangyi'Print(L4)#Delete 1 Delete lastL4.pop ()Print(L4)#Specifies to delete one deleteL4.remove ('g')Print(L4)#del Global DeletedelL4[2]Print(L4)delL4[3:10]Print(L4)" "#循环for i in L4:print (i) #range generate a list for I in range: print (i)" "Print('=========')#SortPrint(L4)#L4.sort ()Print(L4)#Reverse in situL4.reverse ()Print(L4.reverse ())Print('=========')#List LinksL5 = la+L4Print(L5) L6=La.extend (L4)Print(L6)#replication is completely independentPrint("Copy") L6=l4.copy () l6[2]='AAA'Print(L4)Print(L6)
View Code

Luffy Learning City-python Development Training--Chapter II

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.