title: Escape double quotes for JSON in Python
body: <p>How can I replace double quotes with a backslash and double quotes in Python?  </p>
  
  <pre><code>&gt;&gt;&gt; s = 'my string with "double quotes" blablabla'
  &gt;&gt;&gt; s.replace('"', '\\"')
  'my string with \\"double quotes\\" blablabla'
  &gt;&gt;&gt; s.replace('"', '\\\"')
  'my string with \\"double quotes\\" blablabla'
  </code></pre>
  
  <p>I would like to get the following:</p>
  
  <pre><code>'my string with \"double quotes\" blablabla'
  </code></pre>