use of index (beginner's question)
Chris Angelico
rosuav at gmail.com
Wed Apr 27 21:45:08 EDT 2011
On Thu, Apr 28, 2011 at 11:23 AM, Thomas 'PointedEars' Lahn
<PointedEars at web.de> wrote:
> You forgot a comma after the first `]', to separate the list elements.
Whoops! Apologies. It's very confusing when example code has silly
bugs in it! And yes, need to either back down the indices or insert a
shim. Memo, to self: Run the code through IDLE before posting it,
saves people a lot of trouble!
Incidentally, you're allowed to put the comma on the last item too:
lists = [
['pig', 'horse', 'moose'],
['62327', '49123', '79115'],
]
Often makes for easier maintenance, especially when you append
array/list elements.
Chris Angelico
More information about the Python-list
mailing list