interpretation of special characters in Python
Tribulations at Paralleles.invalid
Mon Jul 7 07:32:42 CEST 2008
Peter Pearson wrote:
Thanks for your answer.
> When you run echo, it recognizes the 4-character "esc" as a
> convention for representing a single character, and performs
> the re-interpretation for you. When you tell python
> "print '\033[30;44m foo \033[0m'", python interprets
> the "\033" as a single character.
So, the python print command *can* interpret these 4-character as a single
character. It would be odd if there were no possibility to do the same
thing when the characters are (i) stored in a python variable, or (ii) come
from the environment variables. Does anybody know any way to re-interpret a
string in Python? I have tried to play with "eval" (as in bash), but it
does not yield anything.
TP (Tribulations Parallèles)
"Allez, Monsieur, allez, et la foi vous viendra." (D'Alembert).
More information about the Python-list