CSV prints blank column between each data column
<p>So, the title explains my question - please see the image for clarification. </p>

<p><a href="https://i.stack.imgur.com/gPJGV.png" rel="nofollow"><img src="https://i.stack.imgur.com/gPJGV.png" alt="enter image description here"></a></p>

<p>I have tried the fixes from a couple of questions on here to no avail, so here is my code: </p>

<pre><code>def csv_writer(file_a, file_b):
    with open('Comparison.csv', 'wb') as csv_file:
        writer = csv.writer(csv_file, delimiter=',', escapechar=' ', lineterminator='\n', quoting=csv.QUOTE_NONE)
        line = map(compare, file_a.master_list, file_b.master_list)
        for line in line:
            if line != None:
                writer.writerow(line)
            else:
                del line
</code></pre>

<p>The data for <code>line</code> on line 6 is a list in the following format:
<code>['20,', 'start,', '1000,', '1002']</code>.</p>

<p>I assume that my issue is to do with <code>escapechar=' '</code>, but having tried a variety of different options with no success I'm at a loss. </p>

<p>I believe what is happening is that you are getting two <code>,</code> characters between each data item.</p>

<p>For example, in <code>['20,', 'start,', '1000,', '1002']</code>, each element is joined with a <code>,</code> because of the <code>delimiter=','</code> option. This means that the <code>,</code> is being repeated and you'll end up with:</p>

<pre><code>20,,start,,1000,,1002
</code></pre>

<p>Notice how there is an empty item between each of the items you want.</p>

<p>You can probably fix this by replacing <code>delimiter=','</code> with <code>delimiter=''</code> as you already have the <code>,</code> character and don't need another one.</p>

<p>Hope this helps!</p>

python python-2.7 csv