Translate escaped characters in a string

Ben Finney bignose-hates-spam at and-benfinney-does-too.id.au
Fri Apr 2 18:49:08 EST 2004


On 2 Apr 2004 15:57:59 -0800, - wrote:
> (\n is slash+n, and not LF)

No, "\n" is backslash + n.  Slash + n would be "/n".

> I would like to use \n and other supported escape sequences when I
> write the text to a file.

Once you know the proper name for the character you're talking about,
you can find modules like this one:

    <http://www.crazy-compilers.com/py-lib/shellwords.html>

which may be helpful.

-- 
 \                   "The best is the enemy of the good."  -- Voltaire |
  `\                                                                   |
_o__)                                                                  |
Ben Finney <http://bignose.squidly.org/>



More information about the Python-list mailing list