You can use the Python unicodecsv module as follows:
import unicodecsv with open('input.csv', 'rb') as f_input: csv_reader = unicodecsv.reader(f_input, encoding='utf-8-sig') print list(csv_reader)
So, for an input file containing the following in UTF-8 with the specification:
c1,c2,c3,c4,c5,c6,c7,c8 1,2,3,4,5,6,7,8
This will display the following:
[[u'c1', u'c2', u'c3', u'c4', u'c5', u'c6', u'c7', u'c8'], [u'1', u'2', u'3', u'4', u'5', u'6', u'7', u'8']]
The unicodecsv module can be installed using pip as follows:
pip install unicodecsv
Martin evans
source share