Search
Searches topics and replies. Every word has to appear in the post.
9 posts found.
| Post | Posted |
|---|---|
Thanks, had the same thing with a script exporting addresses. newline="" did it. | by Anonymous |
Leaving this here because I spent an hour on it. My Python CSV export had blank lines between every record when opened on Windows. Opening the output with newline="" fixed it: with open("out.csv", "w", newline="") as f: writer = csv.writer(… | by Anonymous |
Worked first try. Resolved. | by Anonymous |
The csv module in the standard library. csv.reader handles quotes and embedded commas. Open the file with newline="" for reading too, same reason as writing. | by Anonymous |
Splitting lines on commas breaks on rows like: "Smith, John",42,"Portland, OR" I know I should use a real parser. Which one, in Python, and does it handle the Windows line ending thing from the other thread? | by Anonymous |
That fixed it, thanks both! José is back. | by bea |
And keep newline="" on that open() call if you're using the csv module. | by lintroller !-TjZOnKc |
Nothing wrong, Excel is guessing. Without a BOM it assumes the Windows codepage when you double click a CSV. Use encoding="utf-8-sig" and it'll write the three BOM bytes at the start, and Excel will then read it as UTF-8. Don't use it for f… | by ines |
My class list has names like José and Zoë. I write it from Python with open("list.csv", "w", encoding="utf-8") and LibreOffice shows it correctly. On the school computers with Excel it shows José. What did I do wrong? | by bea |