I\'ve tried all manner of Python modules and they either escape too much or in the wrong way. What\'s the best way you\'ve found to escape quotes (\", \') in Python?
Use json.dumps.
json.dumps
>>> import json >>> print json.dumps('a"bc') "a\"bc"