Python Tip #312 (of 365): Use the "utf-8-sig" encoding for CSV files. Many CSV f...

@treyhunner@mastodon.social

Python Tip #312 (of 365):

Use the "utf-8-sig" encoding for CSV files.

Many CSV files start with an invisible byte order mark (BOM).

When read as "utf-8", the first column name starts with a UTF-8 BOM character:

>>> rows[0]
{'\ufeffdate': '2026-10-01', 'kwh': '12.5'}

๐Ÿงต (1/3)

#Python #DailyPythonTip