arrays in python

Simon Forman sajmikins at gmail.com
Wed Sep 23 16:04:45 EDT 2009


On Wed, Sep 23, 2009 at 1:22 PM, Donn <donn.ingle at gmail.com> 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)
>

Of course, in this example you could just say,

l = range(1,5000000)

Or in python 3,

l = list(range(1,5000000))



More information about the Python-list mailing list