how to build arbitrarily-sized lists in one fell swoop?
Jürgen Hermann
jhe at webde-ag.de
Tue Jul 25 10:23:44 EDT 2000
"Samuel Scarano" <srs25 at cornell.edu> schrieb im Newsbeitrag
news:397DA1E0.B65DC47 at cornell.edu...
> There's a simple thing I want to do in python but I can't find a way that
is
> obvious to the reader and efficient for the interpreter. I want to make a
> list with n copies of x.
Now that's an easy one:
>>> x = 1
>>> [x] * 10
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
More information about the Python-list
mailing list