How do I ignitalize a list please?
Warren Postma
embed at geocities.com
Wed May 3 11:48:32 EDT 2000
More information about the Python-list mailing list
Wed May 3 11:48:32 EDT 2000
- Previous message (by thread): How do I ignitalize a list please?
- Next message (by thread): How do I ignitalize a list please?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Kevin Cazabon" <kcazabon at home.com> wrote in message news:8fOP4.198284$Dv1.2498252 at news1.rdc1.bc.home.com... > This is covered very well (as well as most other aspects of Python) in the > documentation, specifically the Tutorial. > > However, in brief, you simply need to create the empty list first, as > follows: > > list = [] > > list.append("spam") > > for i in range(42): > list.append(i * 42) > > i[12] = "Eggs" > > >>>i[12] > Eggs > > ############### > > However, if you simply say that list=[], you cannot then assign to list[12] > because it doesn't exist yet. You have to append X number of objects to the > list, or create the list with that many elements in the first place using a > "range" loop. > > Kevin. > <cmfinlay at SPAMmagnet.com.au> wrote in message > news:kSUtN6=fLIxjJNG0pGTq25a0tuiY at 4ax.com... > > How do I initialize a 'list' please? > > I read that a list is the only array that can be modified in standard > > python. > > > > (to put it simply) > > > > i = 1 > > mags[0] = 0 > > mags[1] = 1 > > print mags[i] > > > > doesn't work. > > > > Please reply here > > or at cmfinlaySPAM at magnet.com.au > >
- Previous message (by thread): How do I ignitalize a list please?
- Next message (by thread): How do I ignitalize a list please?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list