[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.

Yes, you have to convert beforehand. Dynamic typing and weak typing (as in perl 
or php) aren't the same thing.

Dynamic typing means that you can rebind a variable (or better name) at runtime 
to contain a value with a new type. Weak 
typing means that an object is reinterpreted as a value of another type when 
needed - and (often) leads to difficult errors.


Regards,

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

Reply via email to