[Tutor] Quoting trouble

Kent Johnson kent37 at tds.net
Sat Jan 21 02:36:52 CET 2006


Marilyn Davis wrote:
> significant_headers[each] = text[len(each):].strip().replace('"','\\"').replace('\n',' ')

This looks like you are trying to make an escaped string, with literal 
backslashes. You might prefer using the 'string_escape' codec:
  >>> '\n'.encode('string_escape')
'\\n'

Kent



More information about the Tutor mailing list