[EMAIL PROTECTED] schrieb:
> Do I need to convert string to integer in python? or it will do it for
> me (since dynamic type)?
> 
> In my python script, I have this line:
>     x /= 10;
> 
> when i run it, I get this error:
> TypeError: unsupported operand type(s) for /=: 'unicode' and 'int'
> 
> I want to divide x by 10 and assign that value back to x.
> 
> Thank you.
> 
 >>> x=100
 >>> x/=10
 >>> x
10
 >>> x='100'
 >>> x/=10

Traceback (most recent call last):
   File "<pyshell#4>", line 1, in -toplevel-
     x/=10
TypeError: unsupported operand type(s) for /=: 'str' and 'int'
 >>> x=int(x)/10
 >>> x
10

Michael
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to