How to covert ASCII to integer in Python?

2007-02-22 Thread John
Is there any built in function that converts ASCII to integer or vice versa in Python? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Larry Bates
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

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread keirr
On Feb 22, 5:43 pm, "John" <[EMAIL PROTECTED]> wrote: > Is there any built in function that converts ASCII to integer or vice versa > in Python? > > Thanks! Try int. ie. try: int_val = int(str_val) except ValueError: # conversion failed Keir. -- Keir Robinson Sometimes a scream is better

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread hg
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' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Jeff McNeil
Or perhaps... ord ("a") 97 chr (97) 'a' On 2/22/07, hg <[EMAIL PROTECTED]> wrote: 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' >>> -- http://mail.python.org/mailman/listinfo/pytho

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread John
I just found ord(c), which convert ascii to integer. Anybody know what the reverse is? "John" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there any built in function that converts ASCII to integer or vice versa > in Python? > > Thanks! > > -- http://mail.python.org/mailman

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Lloyd Zusman
"John" <[EMAIL PROTECTED]> writes: > I just found ord(c), which convert ascii to integer. > > Anybody know what the reverse is? The inverse of "ord" is "chr": % python Python 2.5 (r25:51908, Jan 5 2007, 00:12:45) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 Type "help", "copy

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Larry Bates
John wrote: > I just found ord(c), which convert ascii to integer. > > Anybody know what the reverse is? > > "John" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Is there any built in function that converts ASCII to integer or vice > versa >> in Python? >> >> Thanks! >> >> > >

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread Paul Rubin
"John" <[EMAIL PROTECTED]> writes: > I just found ord(c), which convert ascii to integer. > Anybody know what the reverse is? chr(i) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread MRAB
On Feb 22, 6:35 pm, Lloyd Zusman <[EMAIL PROTECTED]> wrote: > "John" <[EMAIL PROTECTED]> writes: > > I just found ord(c), which convert ascii to integer. > > > Anybody know what the reverse is? > > The inverse of "ord" is "chr": > > % python > Python 2.5 (r25:51908, Jan 5 2007, 00:12:45) > [

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread John Machin
On Feb 23, 5:23 am, "John" <[EMAIL PROTECTED]> wrote: > I just found ord(c), which convert ascii to integer. ord('\xff') -> 255 ord(unichr(666)) -> 666 What ascii? What is stopping you from reading the documentation section on built- in functions (http://docs.python.org/lib/built-in-funcs.html)?

Re: How to covert ASCII to integer in Python?

2007-02-22 Thread hg
Some people spend many buck bying guessing games ... be nice ! hg -- http://mail.python.org/mailman/listinfo/python-list