I am readying a cvs file,
this is my code:
import csv class CsvToJson: def __init__(self, csvFilePath): with open(csvFilePath, 'rb') as csvFile: spamreader = csv.reader(csvFile, delimiter= ‘;’, quotechar = '|') for row in spamreader: print ', '.join(row) k = CsvToJson(csvFilePath = 'carsModelsMakes.csv') I got this error
SyntaxError: Non-ASCII character '\xe2' in file CsvToJson.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details on the fifth line.
I read on internet and it seems the solution is to use
# -*- coding: utf-8 -*- in the beginning of the file.
I did that but then i got this error:
File "CsvToJson.py", line 6 spamreader = csv.reader(csvFile, delimiter= ‘;’, quotechar = '|') SyntaxError: invalid syntax could you help please