How to define a string in python with double and single quotes
<p>I am using python to communicate with the OS.</p>

<p>I need to create a string of the following form:</p>

<pre><code>string = "done('1') &amp;&amp; done('2')"
</code></pre>

<p>Note that my string MUST have the double quotes in it, but I am not sure how to do that since the double quotes are used in python for defining a string.</p>

<p>Then I do something like:</p>

<pre><code>os.system(string)
</code></pre>

<p>But the system would only read the string with the double and single quotes in it.</p>

<p>I tried:</p>

<pre><code>&gt;&gt;&gt; s = '"done('1') &amp;&amp; done('2')"'
  File "&lt;stdin&gt;", line 1
    s = '"done('1') &amp;&amp; done('2')"'
                ^
SyntaxError: invalid syntax
</code></pre>

<p>I also tried the triple quotes suggested here but i get an error:</p>

<pre><code>&gt;&gt;&gt; s = """"done('1') &amp;&amp; done('2')""""
  File "&lt;stdin&gt;", line 1
    s = """"done('1') &amp;&amp; done('2')""""
                                     ^
SyntaxError: EOL while scanning string literal
</code></pre>

<p><a href="http://stackoverflow.com/questions/8107103/how-to-store-a-string-containing-both-single-quote-and-double-quote-in?rq=1">How to store a string containing both single quote( &#39; ) and double quote( &quot; ) in python</a></p>
