[Baypiggies] One and two dim arrays in Python

Dylan Reinhardt python at dylanreinhardt.com
Tue Aug 26 02:05:26 CEST 2008


There's not much need to dimension arrays in Python.

But if you want to anyway, what about:

a = [None] * 10

HTH,

Dylan



On Mon, Aug 25, 2008 at 4:49 PM, David Elsen <elsen.david08 at gmail.com> wrote:
> Hi all,
>
> I would like to do something like following in Python:
>
> for i in range(0,10):
>      a[i] = something
>
> just to initialize some values for 1d array.
>
> I am getting the error message 'a' is not defined.
>
> Is there a way to declare 1d or 2d arrays in Python?
>
> Thanks,
> David
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>


More information about the Baypiggies mailing list