Serhiy Storchaka added the comment: > this doesn't work if you use the wrong quote. without introspecting the data > in e you can't reliably choose whether to use "'%s'" '"%s"' '"""%s"""' or > "'''%s'''".
Indeed. > and again tools other than python will run into escaped quotes in the data > which may cause problems. Then use s.translate() or re.sub() for encoding. > when i execute this i get a traceback Sorry, it should be e.encode('latin1', 'backslashreplace').decode('unicode-escape'). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18679> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com