[Solved] How can I read 1 value from a list in python? [closed]


Read a specific item in index i:

item = L[index]

Read a sequence of items from index ‘start’ to index ‘stop’:

seq = L[start:stop]

Iterate over a list:

for item in L:
    print item

If you need both the index and the item, use the enumerate function:

for index, item in enumerate(L):
    print index, item

You can also get the reversed list:

L.reverse()

Get list length:

length = len(L)

And there are so much more operations you can perform on lists.

2

solved How can I read 1 value from a list in python? [closed]