TypeError: list indices must be integers, not tuple
Dave Angel
davea at davea.name
Tue Feb 10 10:51:27 EST 2015
On 02/10/2015 09:33 AM, Chris Angelico wrote:
> On Wed, Feb 11, 2015 at 1:28 AM, Dave Angel <davea at davea.name> wrote:
>>> If you can show me a one tuple anywhere in the original code I'll
>>> happily buy you a tipple of your choice.
>>
>>
>> print Menu[fav,RandomNum]
>>
>> was in the original code
>
> That's not a one-tuple (as in, a tuple with one element), it's a
> two-element tuple. The point is that ("3") doesn't create a tuple,
> it's just superfluous parentheses.
You're right of course. I didn't notice the meaning of one-tuple; I took
Mark's comment as if he had said:
If you can show me a <rubout><rubout> one tuple anywhere ...
The original error message said there was a tuple; I knew that fav
wasn't the tuple, but the combination of fav and RandomNum was.
--
DaveA
More information about the Python-list
mailing list