convert integer to string

MRAB python at mrabarnett.plus.com
Sun Apr 29 13:36:05 EDT 2012


On 29/04/2012 18:18, Andres Soto wrote:
> I have already
>> >> import string
>> >> from string import *
> but I can not still convert an integer to string
>> >> str(42)
> Traceback (most recent call last):
> File "<pyshell#20>", line 1, in <module>
> str(42)
> TypeError: 'module' object is not callable
>> >>
> What is it wrong?
>
At some point you have bound "str" to a module.

Normally you would be getting this:

 >>> str is __builtins__.str
True



More information about the Python-list mailing list