You have to tell open that this is UTF-8 with BOM. I know that works with io.open:
import io
.
.
.
inputFile = io.open("test.csv", "r", encoding='utf-8-sig')
.
.
.
And you have to open the file in text mode, “r” instead of “rb”.
More Related Contents:
- Merging two CSV files using Python
- A simple maths operation on a CSV column using python [closed]
- How to write a python code which copies a unique column from an output file to a .csv file
- Skip the headers when editing a csv file using Python
- How to add a new column to a CSV file?
- Skip rows during csv import pandas
- How to avoid Python/Pandas creating an index in a saved csv?
- Python CSV error: line contains NULL byte
- What is the fastest way to upload a big csv file in notebook to work with python pandas?
- sort csv by column
- Compare two CSV files and search for similar items
- Pandas read csv file with float values results in weird rounding and decimal digits
- Why does csvwriter.writerow() put a comma after each character?
- How to delete columns in a CSV file?
- Precision lost while using read_csv in pandas
- Python Pandas: How to read only first n rows of CSV files in?
- Modify an existing Excel file using Openpyxl in Python
- Writing List of Strings to Excel CSV File in Python
- How can I get dictionary key as variable directly in Python (not by searching from value)?
- Read .csv file from URL into Python 3.x – _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?)
- Find all CSV files in a directory using Python
- Calculate summary statistics of columns in dataframe
- Extract csv file specific columns to list in Python
- Python – re-ordering columns in a csv
- ValueError: not enough values to unpack (expected 11, got 1)
- how to specify the datetime format in read_csv
- UnicodeDecodeError when reading CSV file in Pandas
- How to upload a CSV file in FastAPI and convert it into JSON?
- Convert nested JSON to CSV file in Python
- ValueError: x and y must be the same size