Dynamically making lists?

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


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.





More information about the Python-list mailing list