H
Henrik S. Hansen
How do you best go about translating characters like '\\n' to '\n'?
This is for a configuration file parser, where the "backslash
convention" is supported.
The naive approach -- re.sub('\\\\(.)', '\\\1', s) -- doesn't work, of
course. The best I've come up with so far is a special case for every
character to be translated. There must be an easier way?
This is for a configuration file parser, where the "backslash
convention" is supported.
The naive approach -- re.sub('\\\\(.)', '\\\1', s) -- doesn't work, of
course. The best I've come up with so far is a special case for every
character to be translated. There must be an easier way?