How to replace " (double quote) with space or remove space?
<p>It's a very simple and basic question that remove double quotes in python, I couldn't get it.</p>

<pre><code>print text
"'abc' : 'xyz'"
</code></pre>

<p>I want it to display as below</p>

<pre><code>'abc' : 'xyz'
</code></pre>

<p>tried many ways but didn't get the required way</p>

<pre><code>text.replace("\""," "); # but it display as it is.
</code></pre>

<p>Could someone tell me to correct syntax?</p>

<p>You don't specify how <code>text</code> was defined.  Consider:</p>

<pre><code>&gt;&gt;&gt; text = "'abc' : 'xyz'"
&gt;&gt;&gt; print text
'abc' : 'xyz'
</code></pre>

<p>That prints as you want.  So, maybe you defined <code>text</code> like this:</p>

<pre><code>&gt;&gt;&gt; text = "\"'abc' : 'xyz'\""
&gt;&gt;&gt; print text
"'abc' : 'xyz'"
</code></pre>

<p>That shows the print out that you see.  To eliminate the <code>"</code>:</p>

<pre><code>&gt;&gt;&gt; print text.replace('"', '')
'abc' : 'xyz'
</code></pre>

python python-2.7