I want to read 2 different types of CSV-files:
- one with a
','
as delimiter - one with a
';'
as delimiter
I tried to check which delimiter I'm using by doing:
dialect = csv.Sniffer().sniff(csvfile, [',', ';'])
data = csv.reader(csvfile, dialect)
but then I get the TypeError : expected string or buffer
.
If I do this, it works, but then I don't know when to use what delimiter.
data = csv.reader(csvfile, delimiter = ",")
data = csv.reader(csvfile, delimiter = ";")
Can someone help me please?