Backslash escaping is not working in Python
<p>I want Python interpreter to show me <code>\'</code> as a calculated value. I tried typing <code>"\\'"</code> and it returned me the same thing. If I try <code>"\'"</code> then the backslash is not shown anymore after I hit return. How do I get it to show the backslash like this after I hit return- <code>\'</code> ?</p>

<h3>Additional question</h3>

<p>This is exact question I am not understanding: 
Expression --> </p>

<blockquote>
  <p>'C' + <code></code> + 'D'</p>
</blockquote>

<p>Calculated Value --></p>

<blockquote>
  <p>'C\'D'</p>
</blockquote>

<p>Find the missing literal </p>

<p>Here are two ways to get <code>\'</code>:</p>

<pre><code>&gt;&gt;&gt; print("\\'")
\'
&gt;&gt;&gt; print(r"\'")
\'
</code></pre>

<h3>Discussion</h3>

<pre><code>&gt;&gt;&gt; print("\'")
'
</code></pre>

<p>The above prints out a single <code>'</code> because an escaped <code>'</code> is just a <code>'</code>.</p>

<pre><code>&gt;&gt;&gt; print(r"\'")
\'
</code></pre>

<p>The above prints the backslash because <code>r</code> prevents interpretation of escapes.</p>

<pre><code>&gt;&gt;&gt; print("\\'")
\'
</code></pre>

<p>The above prints <code>\'</code> because an escaped backslash is a backslash.</p>

<h3>Other forms of strings</h3>

<p>Using unicode-strings (under python2):</p>

<pre><code>&gt;&gt;&gt; print(u"\\'")
\'
&gt;&gt;&gt; print(ur"\'")
\'
</code></pre>

<p>Using byte-codes (also python 2):</p>

<pre><code>&gt;&gt;&gt; print(b"\\'")
\'
&gt;&gt;&gt; print(br"\'")
\'
</code></pre>

<h3>Answer for additional question</h3>

<p>Using the principles described above, the answer for the additional question is:</p>

<pre><code>&gt;&gt;&gt; print('C' + "\\'" 'D')
C\'D
&gt;&gt;&gt; print('C' + r"\'" 'D')
C\'D
</code></pre>

python