[Tutor] Integer to String possible????

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Sun, 20 Aug 2000 13:54:46 -0700 (PDT)

On Sun, 20 Aug 2000, Albert Antiquera wrote:
>    From my last question I couldn't save to a txt file. I had some 
> improvements and I could save part of the result (strings) in to the text 
> file; but now I couldn't include the integer part because the 
> ".writelines()"method doesn't like it. Is there a way to get around 
> this?Possibly a way to convert an Integer to a String?

Hello!  Use the str() function on the integer, and it should work.  str()
works with practically everything.

>> str(42)
>>> str("forty two")                    
'forty two'
>>> str([4, 2])
'[4, 2]'

Hope this helps!