Is there any way to make repr(aString) use double quotes?

Carl Banks imbosol-1049844119 at aerojockey.com
Tue Apr 8 19:32:52 EDT 2003


Lulu of the Lotus-Eaters wrote:
> "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'\"')

You misspelt

     '"%s"' % repr(aString)[1:-1].replace('"',r'\"').replace(r"\'","'")


-- 
CARL BANKS










More information about the Python-list mailing list