Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python list except last element

>>> myList = list(range(1,5))
>>> myList
[1, 2, 3, 4]
>>> myList = myList[:-1]
>>> myList
[1, 2, 3]
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #python #list #element
ADD COMMENT
Topic
Name
4+9 =