[Tutor] simple array access

wesley chun wescpy at gmail.com
Thu Jan 8 03:45:13 CET 2009


> My attempt at array access (like this: array[1,2] ) does not work. What am
> I overlooking? Thanks in advance! :)
>     :
>  pprint (grid.data[1,2])


is that really your name?!? you're famous! ;-) welcome to python!

i'd try...

pprint(grid.data[0][1])

... as many languages start counting at 0 instead of 1, and you needed
a quick syntax fix too.

hope this helps!
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2007,2001
"Python Fundamentals", Prentice Hall, (c)2009
    http://corepython.com

"Python Web Development with Django", Addison Wesley, (c) 2009
http://withdjango.com

wesley.j.chun :: wescpy-at-gmail.com
python training and technical consulting
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com


More information about the Tutor mailing list