Getting "TypeError:list indices must be integers"
Larry Bates
larry.bates at websafe.com
Tue Jun 13 17:48:09 EDT 2006
Girish Sahani wrote:
>> On 13/06/2006 4:11 PM, Girish Sahani wrote:
>> [snip]
>>> instance = ti2(k)
>>> tiNew = ti1.append(instance)
>> ti2 is quacking "function" but ti1 is quacking "list".
>>
>> Possibilities:
>> (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.
> That is corrected. I'm appending a particular element of ti2 to ti1.
> It hasnt been executed because i'm stuck on that TypeError since 2 hours
> :( (2) You have the weirdest system of choosing names that I have seen for
>> decades.
> :((
>> (3) Both of the above.
>>
>> Cheers,
>> John
>>
>
How about just inserting some print statements that show you the
type and value of each index before you use it. It is old fashioned,
but it actually works.
-Larry Bates
More information about the Python-list
mailing list