I have trouble reading the csv file by python. My csv file has Korean and numbers.
Below is my python code.
import csv
import codecs
csvreader = csv.reader(codecs.open('1.csv', 'rU', 'utf-16'))
for row in csvreader:
print(row)
First, there was a UnicodeDecodeError when I enter "for row in csvreader" line in the above code.
So I used the code below then the problem seemed to be solved
csvreader = csv.reader(codecs.open('1.csv', 'rU', 'utf-16'))
Then I ran into NULL byte error. Then I can't figure out what's wrong with the csv file.
[update] I don't think I changed anything from the previous code but my program shows "UnicodeError: UTF-16 stream does not start with BOM"
When I open the csv by excel I can see the table in proper format (image attached at the botton) but when I open it in sublime Text, below is a snippet of what I get.
504b 0304 1400 0600 0800 0000 2100 6322
f979 7701 0000 d405 0000 1300 0802 5b43
6f6e 7465 6e74 5f54 7970 6573 5d2e 786d
6c20 a204 0228 a000 0200 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
If you need more information about my file, let me know!
I appreciate your help. Thanks in advance :)
csv file shown in excel