Python escape sequence complex output
<p>When I am writing the following command in Python IDLE it will give you the output with quotes, I want to know why it is giving such output.</p>

<pre><code>x='''''abc\'abcddd'''''

print x
</code></pre>

<p>This is output of the written code.</p>

<pre><code>''abc'abcddd
</code></pre>

<p>It is due to pythons triple quoted strings:</p>

<pre><code>''' '''
</code></pre>

<p>It interprets everything in between as a character. So in your string:</p>

<pre><code>'''''abc\'abcddd'''''
</code></pre>

<p>The first three quotes 'open' the string. Than it encounters 2 quotes, which it interprets as characters. Next it encounters an escaped quote, which would be printed as a quote anyway, but it still uses the escaped quote. It then encounters the first 3 of the last 5 quotes, ending the triple quoted string. It then encounters 2 more quotes forming an empty string <code>''</code>. </p>

<p>A space at the places python considers 1 'thing':</p>

<pre><code>''' ''abc\'abcddd ''' ''
</code></pre>

python string escaping sequence