Is this possible:
myList = [] myList[12] = \'a\' myList[22] = \'b\' myList[32] = \'c\' myList[42] = \'d\'
When I try, I get:
#
You'll have to pre-fill it with something (e.g. 0 or None) before you can index it:
0
None
myList = [None] * 100 # Create list of 100 'None's myList[12] = 'a' # etc.
Alternatively, use a dict instead of a list, as Alex Martelli suggested.