Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-21-2002, 08:24 AM   #1
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

Rep: Reputation: 30
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


Last edited by llama_meme; 08-21-2002 at 08:33 AM.
Old 07-06-2010, 02:00 PM   #2
LQ Newbie
Registered: Jul 2010
Posts: 1

Rep: Reputation: 0
You can use string.atoi(s, base=8) for octal numbers.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
renaming file with escaped ascii, octal or anything whansard Linux - General 2 08-07-2005 08:59 AM
C++: char* to string, converting? rewriting program? need substr! lrt2003 Programming 2 06-19-2004 03:20 AM
Have problem converting a decimal number to octal Linh Programming 4 05-20-2004 03:21 PM
Can 't convert from a character to octal value in memory Linh Programming 2 07-21-2003 03:11 PM
ASCII char mapping tlennon Linux - Newbie 0 03-05-2001 07:10 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration