how to convert string

Peter Hansen peter at engcorp.com
Wed Apr 5 15:36:11 EDT 2006


diffuser78 at gmail.com wrote:
> I want to print number 0 to 9 in one line like this
> 0 1 2 3 4 5 6 7 8 9
> 
> if I do like this, it prints in different lines
> 
> for i in xrange(10):
>     print i
> 
> so i tried like this
> 
> str = ""
> for i in xrange(10):
>     str = i + " "
> print str
> 
> but i want to know how convert int i to string.
> 
> Every help is appreciate.

I think you'd learn the answers to this question and many more that 
you're likely to ask if you would do the online tutorial at 
http://docs.python.org/tut/tut.html

-Peter




More information about the Python-list mailing list