lists....order...
gabor
gabor at realtime.sk
Wed Oct 9 19:58:44 EDT 2002
hi,
1.
a = [1,2,3,4,5,6]
for item in a:
print a
will print 1 2 3 4 5 6?
in other words, is it guarantied that for a list the elements will be
enumerated in their order?
2. many times i use this construct:
a = ["a","b","c","d"]
for letter in a:
dosomething..
but now i really need the position of the letter in that list
so i need an x, for which a[x] = letter...
the only solution i could find:
for index in range(len(a)):
letter = a[index]
is there a way to do that with the normal 'for letter in a' approach?
thanks,
gabor
--
listening to Yuki Kajiura - The World
More information about the Python-list
mailing list