meine Liste erstellen
mylist=["singam", "goat", "rayyan", "leo"]
print(mylist)
print(mylist[2])
mylist[1]="mersal"
print(mylist)
mylist=["singam","goat","raayan"]
mylist.append("mersal")
print(mylist)
mylist=["singam","goat","raayan"]
mylist.insert(1,"Mersal")
print(mylist)
mylist=["singam", "goat", "rayaan", "mersal"]
mylist.remove("singam")
print(mylist)
mylist=["singam", "goat", "rayaan", "mersal"]
für x in meiner Liste:
print(x)
mylist=["singam", "goat", "rayaan", "mersal"]
mylist.sort()
print(mylist)
mylist=["singam", "goat", "rayaan", "mersal"]
mylist.pop()
print(mylist)
o/p
['singam', 'goat', 'rayyan', 'leo']
rayyan
['singam', 'mersal', 'rayyan', 'leo']
['singam', 'goat', 'raayan', 'mersal']
['singam', 'Mersal', 'goat', 'raayan']
['Ziege', 'rayaan', 'mersal']
singam
Ziege
rayaan
Mersal
['Ziege', 'mersal', 'rayaan', 'singam']
['singam', 'ziege', 'rayaan']
Das obige ist der detaillierte Inhalt vonPython-Programmlisten. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!