How to avoid BOM issues with CSV files created on Windows
· Tags: python csv microsoftWhen loading CSV files in Python that were created on Windows, you can get some weird errors because the Microsoft tools usually add a BOM.
You can workaround that by using the encoding 'utf-8-sig', which will work
also for regular UTF-8 files without the mark. Like this:
with open('MY_FILE.csv', encoding='utf-8-sig'):
data = list(csv.DictReader(f))