lists....order...
Daniel Klein
danielk at aracnet.com
Thu Oct 10 08:36:29 EDT 2002
More information about the Python-list mailing list
Thu Oct 10 08:36:29 EDT 2002
- Previous message (by thread): lists....order...
- Next message (by thread): network programming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 10 Oct 2002 01:58:44 +0200, gabor <gabor at realtime.sk> wrote: >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... > There's always the old-fashion way... position = 0 for letter in a: print letter, position position += 1 Dan.
- Previous message (by thread): lists....order...
- Next message (by thread): network programming
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list