Re: How to covert ASCII to integer in Python?



Skonieczny, Chris wrote:

YOU SHOULD REMOVE or CORRECT YOUR POST here:
http://mail.python.org/pipermail/python-list/2007-February/427841.html

It is not true - eg. try :
a='P' # P is ASCII , isn't it ?
b=int(a)
and what you will get ? An error !!!

Or probably you yourself should - quote :
"You probably should go through the tutorial ASAP that is located here:

http://docs.python.org/tut/ "

int() converts a strings that is a valid intenter. What you're looking for
is ord().

In [1]: ord('d')
Out[1]: 100

In [2]: a='P'

In [3]: b=ord(a)

In [4]: b
Out[4]: 80

j

.



Relevant Pages

  • setup for my new EXL-1
    ... Just came back from Chris Forshage who did setup for my EXL-1. ... First order of business was truss rod - needed a lot of tightening. ... stronger on treble E and bass E but weaker in the middle strings. ... especially playing fingerstyle - it is fuller and not scratchy now. ...
    (rec.music.makers.guitar.jazz)
  • Re: Search for best matched portion of a string
    ... Chris F.A. Johnson wrote: ... >>The strings that I mentioned are just examples...may be the words can ... And please don't continue these separate threads in multiple NGs. ...
    (comp.unix.shell)
  • Re: What Is B Major
    ... >> hit all the strings when strumming. ... A barre chord with that much gain would be a wall of fuzz. ... Chris ...
    (alt.guitar.beginner)
  • Re: Compare two strings with same characters, but different order.
    ... (remove nothere from the email address if mailing direct) ... "chris" wrote in message ... strings with all the same characters but different order of charactrers. ...
    (microsoft.public.excel.programming)
  • Re: Delete the path
    ... Chris F.A. Johnson wrote: ... > tr is for translating characters, not strings. ...
    (comp.unix.shell)