Python csv - Error when read data from csv file

I wrote a utility function to read data from a csv file and add them to a dictionary (read here). But, you will get the following error when using that function:

Traceback (most recent call last):
...
    sniffdialect = csv.Sniffer().sniff(csv_file.read(10000), delimiters='\t,;')
  File "/usr/lib/python2.7/csv.py", line 184, in sniff
    raise Error, "Could not determine delimiter"
_csv.Error: Could not determine delimiter



It is because the csv file you are using is not in Unicode (UTF-8) format. So, to fix this error, please make sure the input csv file is formatted with UTF-8 standard (Not only Unicode).

* Not good:



* Good:



Comments