[Tutor] Question: Converting ints to strings
Mon, 24 Apr 2000 17:23:19 +1000
From: Fiel Cabral <email@example.com>
To: firstname.lastname@example.org <email@example.com>
Date: Sunday, April 23, 2000 11:48 AM
Subject: [Tutor] Question: Converting ints to strings
>Please tell me how to convert an int to a string.
>I'm trying to do the following:
> block_number = 1
> file_name = 'temp.file'
> output = open(file_name + '.$' + block_number + '$', 'wb')
>This didn't work. I was hoping that it would create
>a file called 'temp.file.$1$'.
For any object x, str(x) will return a string which is a printable
representation of that object.
so you can use:
output = open(file_name + '.$' + str(block_number) + '$', 'wb')
Jason Stokes: firstname.lastname@example.org