creating lists question?
Matt Gerrans
matt.gerrans at hp.com
Tue Mar 23 19:13:59 EST 2004
"spisatus" wrote:
> I'm not sure this is doing what I want it to do. In the example I gave I
> want a new list call "aaa" another list called "bbb"... so I can append to
> the new list i.e., bbb.append(). It may be that your example does this
but
> it appears to be (with my limited knowledge) that it's creating a list of
> lists, when all I want is a new isolated list.
This would do the trick:
for item in list1:
exec( item + ' = []' )
Of course, there are the usual cautions about using exec() and error
handling...
More information about the Python-list
mailing list