[Tutor] unsupported operand

Steven D'Aprano steve at pearwood.info
Sun Dec 18 02:07:27 CET 2011


stm atoc wrote:

> and this is the error that I got:

Would you like us to guess which line causes the error?

Please show the ENTIRE traceback. Do not retype it from memory, paraphrase or 
simplify it, or otherwise change it in any way. Copy and paste it.

> TypeError: unsupported operand type(s) for -: 'list' and 'int'
> 
> What would you suggest?

The code sample you showed did not include any subtractions. This hints that 
perhaps you are not showing us all of the code you are actually running. The 
full traceback will answer that one way or the other.

Otherwise, I suggest you look at the line which the traceback prints. It 
probably has something like "result = a - b" (or some other subtraction). Look 
for the two variables: one of them is set to a list.


-- 
Steven



More information about the Tutor mailing list