names = 'ZhangYang guyun xiangpeng xuliangwchen'
names = ['zhangYang','111guyun','xiangpeng','##chenronghua','54xuliangchen']names.append('leihaidong')names.insert(1,'chenronghua')names.insert(3,'xinzhiyu') #插入names[2] = 'xiedi' #改#print(names[0],names[2])#print(names[1:3]) #切片#print(names[3]) #切片#print(names[-1]) #切片#print(names[-2:]) #切片#print(names[0:3]) #切片#print(names[:3]) #切片#print(names[0:]) #切片#print(names) #切片#delete 删除有以下三种方式#names.remove('chenronghua')#del names[1]#names.pop(1)#print(names.index('xiedi')) #查找xiedi的序列号#print(names.index('xiedi'))#print(names[names.index('xiedi')])#print(names.count('chenronghua'))#names.clear() #清空列表#names.reverse() #反转列表,顺序反过来#names.sort()print(names)names2 = [1,2,3,4]names.extend(names2) #合并列表del names2print(names)