[Baypiggies] One and two dim arrays in Python

David Elsen elsen.david08 at gmail.com
Tue Aug 26 02:05:11 CEST 2008


Thanks Sherman

but how does it work if I want to change my "something" for each index  of
i.

On Mon, Aug 25, 2008 at 5:00 PM, Shiqi Yang <sherman.yang at gmail.com> wrote:

> maybe you can try this:
> a = [ something for i in range(10)]
>
> hope it helps
>
> :)
>
> On Mon, Aug 25, 2008 at 4:53 PM, David Elsen <elsen.david08 at gmail.com>
> wrote:
> > I have declared 'a' as :
> > a=[] before the for loop. But it does not seem to help.
> >
> > 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
> >
>
>
>
> --
> Sherman Yang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20080825/42df21e3/attachment-0001.htm>


More information about the Baypiggies mailing list