Problem with a for loop and a list

A.T.Hofkamp hat at se-162.se.wtb.tue.nl
Wed Jul 2 10:15:47 CEST 2008


On 2008-07-02, Alexnb <alexnbryan at gmail.com> wrote:
> I have no idea what "list assignment index out of range means?!?!

You are assigning a value to a non-existing list element, as in

>>> x = [1]
>>> x[2] = 4
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  IndexError: list assignment index out of range


Albert



More information about the Python-list mailing list