443,272 Members | 1,733 Online
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,272 IT Pros & Developers. It's quick & easy.

# How to covert ASCII to integer in Python?

 P: n/a Is there any built in function that converts ASCII to integer or vice versa in Python? Thanks! Feb 22 '07 #1
10 Replies

 P: n/a John wrote: Is there any built in function that converts ASCII to integer or vice versa in Python? Thanks! You probably should go through the tutorial ASAP that is located here: http://docs.python.org/tut/ Convert ascii string to integer: a='1' b=int(a) Convert integer to ascii string: a=1 b=str(a) or a=1 b="%i" % a -Larry Bates Feb 22 '07 #2

 P: n/a On Feb 22, 5:43 pm, "John"

 P: n/a John wrote: Is there any built in function that converts ASCII to integer or vice versa in Python? Thanks! >>int('10') 10 >>str(10) '10' >>> Feb 22 '07 #4

 P: n/a I just found ord(c), which convert ascii to integer. Anybody know what the reverse is? "John"

 P: n/a John wrote: I just found ord(c), which convert ascii to integer. Anybody know what the reverse is? "John" Is there any built in function that converts ASCII to integer or vice versa >in Python?Thanks! The phrasing of your question threw us all. What you want is chr backslash=chr(92) -Larry Bates Feb 22 '07 #6

 P: n/a "John"

 P: n/a "John" >ord('i') 105 >>chr(105) 'i' >>> IIRC, the first use of the names "ord" and "chr" for these functions appeared in the Basic language in the 1960's ... in case anyone is interested in this bit of historical trivia. -- Lloyd Zusman lj*@asfast.com God bless you. Feb 22 '07 #8

 P: n/a On Feb 22, 6:35 pm, Lloyd Zusman >ord('i') 105 >>chr(105) 'i' >>> IIRC, the first use of the names "ord" and "chr" for these functions appeared in the Basic language in the 1960's ... in case anyone is interested in this bit of historical trivia. In the versions of Basic that I've seen they were ASC (clearly ASCII) and CHR\$. I first saw ord in Pascal. Feb 22 '07 #9

 P: n/a On Feb 23, 5:23 am, "John" Anybody know what the reverse is? "John"

 P: n/a Some people spend many buck bying guessing games ... be nice ! hg Feb 23 '07 #11

### This discussion thread is closed

Replies have been disabled for this discussion.