simple string question

jwither jwither at
Mon Sep 7 09:17:24 CEST 2009

"Chris Rebert" <clp2 at> wrote in message 
news:mailman.1075.1252306208.2854.python-list at
> On Sun, Sep 6, 2009 at 10:29 PM, jwither<jwither at> wrote:
>> Given a string (read from a file) which contains raw escape sequences,
>> (specifically, slash n), what is the best way to convert that to a parsed
>> string, where the escape sequence has been replaced (specifically, by a
>> NEWLINE token)?
> There's probably a more general method covering all the escape
> sequences, but for just \n:
> your_string = your_string.replace("\\n", "\n")
> Cheers,
> Chris
> --

Thanks!  (the others are more likely to be errors than deliberate anyway)

James Withers 

More information about the Python-list mailing list