Paul McGuire wrote:
>>>>text = r"'the','dog\'s','bite'"
>>>>def unquote(s,l,t):
> 
> ...     t2 = t[0][1:-1]
> ...     return t2.replace("\\'","'")
> ...

Note also, that the codec 'string-escape' can be used to do what's done 
with str.replace in this example:

py> s
"'the','dog\\'s','bite'"
py> s.replace("\\'", "'")
"'the','dog's','bite'"
py> s.decode('string-escape')
"'the','dog's','bite'"

Using str.decode() is a little more general as it will also decode other 
escaped characters.  This may be good or bad depending on your needs.

STeVe
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to