一、
list1=['life','is','short']
list2=['you','need','python']
print(list2[2])
print(list2.index('python'))
list2.append('!')
list1.insert(3,',')
print(list1),print(list2)
list1.extend(list2)
list1.sort()
print(list1)
print(len(list1))
list2[2]="python3"
print(list2)
list1.remove(",")
list2.pop(3)
print(list1),print(list2)
三、
list1=['life','is','short']
list2=['you','need','python']
list3=[1,2,3,4,5,3,4,2,1,5,7,9]
list_set1=set(list1)
print(list_set1)
list1.extend(list2)
list_set2=set(list1)
print(list_set2)
print(len(list_set1),len(list_set2))
list_set1.update(list_set2)
list_set1.remove('python')
list_set1.add('python3')
print(list_set1)
网友评论