Is there any way to make repr(aString) use double quotes?
t.evans at paradise.net.nz
Wed Apr 9 13:43:59 CEST 2003
tweedgeezer at hotmail.com (Jeremy Fincher) writes:
> The topic really says it all -- I'd like to *force* repr(aString) to
> use double quotes. Is that possible?
> If it's not, then is it possible to achieve the same thing (everything
> escaped properly, etc.) through other means?
return '"' + s.encode('unicode_escape').replace('"', '\\"') + '"'
More information about the Python-list