Skip to content

gh-132813: Fix the csv documentation for quoting and escaping #133209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Apr 30, 2025

quotechar and new-line characters are always quoted or escaped. escapechar is always escaped.


📚 Documentation preview 📚: https://cpython-previews--133209.org.readthedocs.build/

quotechar and new-line characters are always quoted or escaped.
escapechar is always escaped.
@vadimkantorov
Copy link

What can also be surprising is different behavior for quotechar="" and quotechar=None. I would make them behave the same (currently quotechar="" is not permitted), but it's very subjective indeed

@serhiy-storchaka
Copy link
Member Author

It was. In the past, "" and "\0" were interpreted as None for delimiter, quotechar and escapechar. But it was confusing, and it was impossible to use the null character as the delimiter or whatever.

@vadimkantorov
Copy link

@serhiy-storchaka IIUC, quote_char=None is accepted for QUOTE_NONE, but quote_char="" is not, because there is a check that if it's a str, it must be a 1-char str. For me the fact that quote_char=None is accepted, but quote_char="" is not is strange (not talking here about the null character "\0", just about empty string)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review docs Documentation in the Doc dir needs backport to 3.13 bugs and security fixes skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

2 participants