How to recast integer to a string
6 answers - 102 bytes -

How to recast an integer to a string?
something like
n = 5
str = str + char(n)
J.L
No.1 | | 189 bytes |
| 
Tue, May 09, 2006 at 12:17:34PM -0700, James wrote:
How to recast an integer to a string?
something like
n = 5
str = str + char(n)
str(n)
Kindly
Christoph
No.2 | | 312 bytes |
| 
Christoph Haas wrote:
Tue, May 09, 2006 at 12:17:34PM -0700, James wrote:
How to recast an integer to a string?
something like
n = 5
str = str + char(n)
str(n)
Kindly
Christoph
In python2,4, I 've got
TypeError: 'str' object is not callable
J.L
No.3 | | 179 bytes |
| 
2006-05-09, James <hslee911 (AT) yahoo (DOT) comwrote:
How to recast an integer to a string?
something like
n = 5
str = str + char(n)
str = str + chr(5)
No.4 | | 449 bytes |
| 
Tue, May 09, 2006 at 12:34:05PM -0700, James wrote:
Christoph Haas wrote:
Tue, May 09, 2006 at 12:17:34PM -0700, James wrote:
How to recast an integer to a string?
something like
n = 5
str = str + char(n)
str(n)
Kindly
Christoph
In python2,4, I 've got
TypeError: 'str' object is not callable
What I meant was:
string_from_number = str(n)
Kindly
Christoph
No.5 | | 510 bytes |
| 
James wrote:
How to recast an integer to a string?
something like
n = 5
str = str + char(n)
J.L
Two items:
1) Never use 'str' as a variable name as it will
shadow the built in str function. If you do, this
WILL jump up and bite you.
2) Either s=str(n) or s="%i" % n will return string
containing '5' (without the quotes of course).
Note: chr(n) would return character whose ASCII decimal
value is 5 (ASCII ENQ).
-Larry Bates
No.6 | | 361 bytes |
| 
James wrote:
How to recast an integer to a string?
something like
n = 5
str = str + char(n)
str(n)
Kindly
Christoph
In python2,4, I 've got
TypeError: 'str' object is not callable
if you want to use a builtin function, you cannot use the same name
for your own variables.
</F>