python csv format all rows to one line
<p>Ive a csv file that I would like to get all the rows in one column. Ive tried importing into MS Excel or Formatting it with Notedpad++ . However with each try it considers a piece of data as a new row.
How can I format file with pythons csv module so that it removes a string "BRAS" and corrects the format. Each row is found between a quote " and delimiter is a pipe |.
Update:</p>

<pre><code> "aa|bb|cc|dd|
 ee|ff"
 "ba|bc|bd|be|
 bf"
 "ca|cb|cd|
 ce|cf"
</code></pre>

<p>The above is supposed to be 3 rows, however my editors see them as 5 rows or 6 and so forth.</p>

<pre><code>import csv
import fileinput


with open('ventoya.csv') as f, open('ventoya2.csv', 'w') as w:
    for line in f:
        if 'BRAS' not in line:
            w.write(line)
</code></pre>

<p>N.B I get a unicode error when trying to use in python.</p>

<pre><code> return codecs.charmap_decode(input,self.errors,decoding_table)[0]
 UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 18: character maps to &lt;undefined&gt;
</code></pre>