Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to get last item in list

# The smart way

list = ["first item", "second item", "third item"]
print(list[len(list) - 1])

# The proper way
print(list[-1])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #item #list
ADD COMMENT
Topic
Name
2+3 =