CSV breaks up values on non delimeter
<p>I am trying to read mixed CSV fields, where there are quoted fields and non-quoted numerical with the following :</p>

<pre><code>from csv import reader

bar = """1234,"abc,def","dasd",341234234"""
foo = reader(bar)
[x for x in foo]
</code></pre>

<p>this returns </p>

<pre><code>[['1'], ['2'], ['3'], ['4'], ['', ''], ['abc,def'], ['', ''], ['dasd'], ['', ''], ['3'], ['4'], ['1'], ['2'], ['3'], ['4'], ['2'], ['3'], ['4']]
</code></pre>

<p>I tried using
foo = reader(bar, delimiter=',', quotechar='"')</p>

<p>But it still breaks up numbers. I basically need to read csv.QUOTE_NONNUMERIC
from writer, but it is not reading it properly.</p>

<p>csv reader works on file objects. Here is what you could do</p>

<pre><code>from csv import reader
import StringIO

bar = """1234,"abc,def","dasd",341234234"""
f = StringIO.StringIO(bar)
foo = reader(f,  delimiter=',')
print [x for x in foo]
</code></pre>

<p>This will give you o/p</p>

<pre><code>[['1234', 'abc,def', 'dasd', '341234234']]
</code></pre>

<p>Hope that works for you.</p>

python csv