Declaring array of Variables ?
Chris Rebert
clp2 at rebertia.com
Sun Sep 13 01:06:46 EDT 2009
On Sat, Sep 12, 2009 at 9:51 PM, Lennyboi <leonidas01.rei at gmail.com> wrote:
> Can I declare an array of variables in python like in C
>
> int p[10];
>
> I looked everywhere, but I don't find any mention of it.
Python doesn't have C-like variable declarations, and it does not have
arrays of static length.
The closest you can get is a list prefilled with certain number of
duplicates of a certain value.
p = [0] * 10
or for non-numbers:
p = [None] * 10
Cheers,
Chris
--
http://blog.rebertia.com
More information about the Python-list
mailing list