[Tutor] convert an integer number to string.

Olivier D. purple.meteor at gmail.com
Wed Apr 5 13:45:03 CEST 2006


On 4/5/06, Keo Sophon <keosophon at khmeros.info> wrote:
>
> how to convert an integer number to string?

Use str(object) to convert an object to a string. For example:
>>> str(42)
'42'

The reverse function is int(x) to convert a string to an integer:
>>> int('42')
42


More information about the Tutor mailing list