Python> list> pop ()> Get index {specified / unspecified} + del ()

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic (No. 1292 / 12833)

Get an Item by Offset and Delete It by Using pop()

I've tried.

http://ideone.com/wWqImS

mylist = [ 'zundoko', 'zun', 'KIYOSHI', 'zun' ]

print(mylist.pop())
print(mylist.pop(1)*2)
print(mylist.pop(0))
print(mylist.pop())

result


Success	time: 0 memory: 9024 signal:0
zun
zunzun
zundoko
KIYOSHI

Recommended Posts

Python> list> pop ()> Get index {specified / unspecified} + del ()
Python> list> delete last insertion> del somelist [-1]> somelist.pop () / help ([]. Pop).
Get index of nth largest / smallest value in list in Python
Get index of nth largest / smallest value in list in Python
Get the value of a specific key up to the specified index in the dictionary list in Python
[python] Get a list of instance variables
[Python] list
Get the EDINET code list in Python
[Python] Get a list of folders only
Sort list elements in a specified order in Python
About Python List Index (Paiza POH Lite 4: Mission 3)
Python basics: list
Python> Comprehension / Comprehension> List comprehension
Python list manipulation
[python] Get the list of classes defined in the module
[Python] Get the list of ExifTags names of Pillow library
Python: Get a list of methods for an object