simple string question

ryles rylesny at gmail.com
Mon Sep 7 10:42:14 CEST 2009


> There's probably a more general method covering all the escape
> sequences, but for just \n:
>
> your_string = your_string.replace("\\n", "\n")

py> s = "hello\\r\\n"
py> s
'hello\\r\\n'
py> s.decode("string_escape")
'hello\r\n'
py>




More information about the Python-list mailing list