Getting "TypeError:list indices must be integers"
sjmachin at lexicon.net
Tue Jun 13 03:21:19 EDT 2006
On 13/06/2006 5:08 PM, John Machin wrote:
> On 13/06/2006 4:11 PM, Girish Sahani wrote:
>> instance = ti2(k)
>> tiNew = ti1.append(instance)
> ti2 is quacking "function" but ti1 is quacking "list".
> (1) You meant to type ti2[k] ... and this section of code has not yet
> been executed, and would have featured as episode N+1 had morbid
> curiosity not led me to read further.
> (2) You have the weirdest system of choosing names that I have seen for
> (3) Both of the above.
tiNew = ti1.append(instance)
doesn't do what you think it does:
>>> foo = [9, 8, 7]
>>> bar = 'xyz'
>>> bar = foo.append(42)
[9, 8, 7, 42]
More information about the Python-list