Dynamically making lists?

Bill Witherspoon billw at witherspoon-design.com
Sun Jun 3 14:41:28 EDT 2001


Sorry folks, disregard.
Use slices, duh.


----- Original Message -----
From: "Bill Witherspoon" <billw at witherspoon-design.com>
To: <python-list at python.org>
Sent: Sunday, June 03, 2001 2:27 PM
Subject: Dynamically making lists?


> Hi all,
>
> If I have a list ->
>
> L = ['one', 'two', 'three',......,'one thousand']
>
> and I want to split this into several lists with (say) two elements
> each ->
>
> m = ['one', 'two']
> n = ['three', 'four']
> o = ['five', 'six'}
> ......
> zz = ['nine hundred ninety nine', 'one thousand']
>
> How would I do this?  I don't know how many elements are in L before
> I run the program.
>
> It seems like I have to generate variable names on the fly?
> Maybe there's something simple I'm missing here.
>
> Any pointers would be appreciated.
>
> TIA,
> Bill.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list