473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to recast integer to a string

How to recast an integer to a string?

something like
n = 5
str = str + char(n)
J.L

May 10 '06 #1
6 3674
On 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
May 10 '06 #2

Christoph Haas wrote:
On 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

May 10 '06 #3
On 2006-05-09, James <hs******@yahoo.com> wrote:
How to recast an integer to a string? something like
n = 5
str = str + char(n)


str = str + chr(5)

--
Grant Edwards grante Yow! I want EARS! I
at want two ROUND BLACK
visi.com EARS to make me feel warm
'n secure!!
May 10 '06 #4
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
May 10 '06 #5
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>

May 10 '06 #6
On Tue, May 09, 2006 at 12:34:05PM -0700, James wrote:

Christoph Haas wrote:
On 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
May 10 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim in Arizona | last post by:
I'm learning form an ASP.NET 1.0 book and I tried out some code that returns this error: Compiler Error Message: BC30311: Value of type 'Integer' cannot be converted to...
5
by: Barry | last post by:
Hello, In VS2003, I tried using an enum and setting it into a field in a datarow. It seems as if the datatype of the field in the row determined what went into the field. If the datatype was...
1
by: David | last post by:
Hello, Is there a way to automatically have a member variable in a derived class recast within that class. In other words, something like this: class ABase { protected: BBase *m_something;...
6
by: comp.lang.php | last post by:
I'm involved in a rather nasty debate involving a strange issue (whereby the exasperated tell me to RTFM even after my having done so), where this is insanely possible: print_r(is_int('1'));...
3
by: Jonas | last post by:
Hi! I have a general error logging routine that takes a parameter of type Exception. But if I send in a SqlException, I loose all the Sql-specific information as the variable is casted to an...
3
by: veeman | last post by:
Can someone please write an example containing one element which value is integer type, and one attribute which value is also integer type: Is it something like this: <SomeAttribute...
1
by: =?Utf-8?B?RG9u?= | last post by:
Hello, I'm creating a web service that will allow people to enter their contact information into a SQL Server table. I get it to work when I enter all of the fields and press the invoke button,...
5
by: Housing | last post by:
Hi all, I have a pointer which is double * ptr, it actually points to a 3D array. For the sake of programming ease, is there a way to recast the double * ptr into a form that I can access...
2
by: robtyketto | last post by:
Greetings, Within my jsp I have HTML code (see below) which accepts input, one of these fields sequence unlike the others is an Integer. <FORM ACTION="wk465682AddFAQ.jsp" METHOD="POST"> Id:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.