Declare list of large size
kendall at monkeyfist.com
Tue Mar 19 00:13:26 CET 2002
On Mon, Mar 18, 2002 at 03:44:14PM -0700, Aaron Ginn wrote:
> which will give me a list 100 elements long with all values
> initialized to 0, but I'm assuming there has to be an easier way to do
> this? Am I correct in this assumption?
>> l = [0 for i in range(100)]
>> print l
<list of 100 elements, each of which is 0 snipped>
List comprehensions are everyone's friend.
More information about the Python-list