arrays in python
Ethan Furman
ethan at stoneleaf.us
Wed Sep 23 16:12:24 EDT 2009
Donn wrote:
> On Wednesday 23 September 2009 19:14:20 Rudolf wrote:
>
>>I want to allocate an array and then populate it
>>using a for loop.
>
> You don't need to allocate anything, just use the list or dictionary types.
>
> l=[] #empty list
> for x in range(1,5000000):
> l.append(x)
>
> \d
Works great if you want 4,999,999 elements. ;-) Omit the '1' if you
want all five million.
~Ethan~
More information about the Python-list
mailing list