how to build arbitrarily-sized lists in one fell swoop?

Gaetan Corneau corg at copernic.com
Tue Jul 25 10:31:55 EDT 2000


Easy:

l = [5] * 10

>>> print l
[5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
______________________________________________________
   Gaetan Corneau
   Software Developer 
   Copernic.com 
   http://www.copernic.com
   E-mail: corg at copernic.com                         
______________________________________________________
"Golf is a game whose sole aim is to hit a very small
ball into an even smaller hole, with weapons
singularly ill designed for that purpose." -- Winston Churchill

 




More information about the Python-list mailing list