Is there any way to make repr(aString) use double quotes?
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Tue Apr 8 16:53:45 EDT 2003
"Mike C. Fletcher" <mcfletch at rogers.com> wrote previously:
|> '"%s"' % repr(aString)[1:-1]
|Except when there's a " character in the string ;) .
Ahh... what I MEANT to write was, of course:
'"%s"' % repr(aString)[1:-1].replace('"',r'\"')
Emphasizing the "not pretty" part further. (I still think it is
prettier than Mike's though :-)).
Btw. The OP wrote "string", so obviously I am not interested in
repr(u"x").
Yours, Lulu...
More information about the Python-list
mailing list