On Thu, Dec 25, 2008 at 7:02 AM, James Stroud <jstr...@mbi.ucla.edu> wrote:
> Stef Mientki wrote: > >> hello, >> >> Is there a function to remove escape characters from a string ? >> (preferable all escape characters except "\n"). >> >> thanks, >> Stef >> > > > import string test = 'this\r is a test\t yeah\n' for c in string.printable[-5:]: if c != '\n': test = test.replace(c, ' ') Hmm, should the escape codes be in their own little list in string? Or are they, and I'm just not seeing them? Is string.printable[-5:] a reliable way to get the list of escape codes?
-- http://mail.python.org/mailman/listinfo/python-list