1

I'm trying to open and read a csv file from an url. But getting an error:

Traceback (most recent call last):
  File "C:\Users\Rasmus\Dropbox\Portfolio\src\Main.py", line 8, in <module>
    for line in csvfile:
_csv.Error: line contains NULL byte

Does it have something to do with the encoding?

import csv
import urllib.request
import codecs

url = "https://biz.yahoo.com/p/csv/333conameu.csv"
ftpstream = urllib.request.urlopen(url)
csvfile = csv.reader(codecs.iterdecode(ftpstream, 'utf-8'))
for line in csvfile:
    print(line) 
FareJump
  • 113
  • 2
  • 10

0 Answers0