python--list(using)
list有序的集合,可以随时添加、删除元素
1 #!/usr/bin/env python2 2 # _*_ coding:UTF-8 _*_ 3 4 deskmate=['first','second','zero','fifty'] 5 deskmate.append('uiu') 6 print(deskmate) 7 print(len(deskmate)) 8 deskmate.insert(1,'kitty') 9 print("insert-deskmate:",deskmate) 10 print(len(deskmate)) 11 deskmate.pop(0) 12 print("delete-deskmate:",deskmate) 13 print(len(deskmate)) 14 deskmate.pop() 15 print("delete-last-world:",deskmate) 16 print(len(deskmate)) 17 deskmate[2]='sarach' 18 print(deskmate) 19 #len(deskmate) 20 print(len(deskmate))