python: converting a 3 character octal string into an ASCII char
OK, I'm trying to go through a string and replace all occurences of %xxx (where x is an octal digit) with the coresponding ASCII character.
Two problems: I can't work out how to convert the string xxx into a number (string.atoi is for decimal numbers). curses.ascii.unctrl(), which is supposed to convert a number into its corresponding character doesn't seem to work properly. For example, it treats 65 (decimal) as a control code, and returns some weird string that isn't 'A'. Documentation for it is at http://www.python.org/doc/current/li...ses.ascii.html Alex |
You can use string.atoi(s, base=8) for octal numbers.
|
All times are GMT -5. The time now is 11:37 PM. |