How to ignore NULL byte when reading a csv file
<p>I'm reading a csv file generated from an equipment and I got this error message:</p>

<pre><code>Error: line contains NULL byte
</code></pre>

<p>I opened the csv file in text editor and I do see there're some NUL bytes in the header section, which I don't really care about. How can I make the csv reader function to ignore the NUL byte and just goes through the rest of the file? </p>

<p>There're two blank lines between the header section and the data, maybe there's way to skip the whole header?</p>

<p>My code for reading the csv file is </p>

<pre><code>with open(FileName, 'r', encoding='utf-8') as csvfile:
  csvreader = csv.reader(csvfile)
</code></pre>

<p>This will replace your NULL bytes</p>

<pre><code>csvreader = csv.reader(x.replace('\0', '') for x in csvfile)
</code></pre>

python csv