On Sep 6, 10:29 pm, "jwither" <jwit...@sxder4kmju.com> 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)? > > James Withers
I believe "\n" is a newline. As is "\r\n" and "\r". Choose your demon. mystring = mystring.replace("\n", demon) FYI. If you are reading from a file, you can iterate over the lines without having to worry about newlines: fi = open(path_to_file, 'r') for line in fi: process_line(line) ~Sean -- http://mail.python.org/mailman/listinfo/python-list