Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Conversation
quotechar and new-line characters are always quoted or escaped.escapechar is always escaped.
vadimkantorov commentedApr 30, 2025
What can also be surprising is different behavior for |
It was. In the past, |
vadimkantorov commentedMay 1, 2025
@serhiy-storchaka IIUC, |
Doc/library/csv.rst Outdated
A one-character string used by the writer to escape the *delimiter*, | ||
the *quotechar*, ``'\r'``, ``'\n'`` and any of the characters in | ||
*lineterminator* if *quoting* is set to :const:`QUOTE_NONE`, | ||
the *quotechar* if *doublequote* is :const:`False`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I do not understand this part of the sentence in the original, nor the addition below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
How would you write it?
Different characters are escaped depending on different conditions:
- ifquoting is set to :const:
QUOTE_NONE
, it escapesdelimiter,quotechar, etc. - ifdoublequote is False, it escapesquotechar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Perhaps:
A one-character string for escaping. If quoting is set to :const:QUOTE_NONE, it escapes delimiter, quotechar, ``'\r'``, ``'\n'`` and any of the characters in *lineterminator*. If doublequote is False, it escapes quotechar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I am assuming that the fact changes are correct. I code not parse one sentence before and less so now. I am guessing that it needs to be split into 2 sentences.
When you're done making the requested changes, leave the comment: |
Uh oh!
There was an error while loading.Please reload this page.
vadimkantorov commentedMay 13, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This what this PR does. |
Uh oh!
There was an error while loading.Please reload this page.
I have made the requested changes; please review again. |
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Uh oh!
There was an error while loading.Please reload this page.
quotechar and new-line characters are always quoted or escaped. escapechar is always escaped.
csv.writer
withQUOTE_NONE
still requires non-emtpyquotechar
andescapechar
#132813📚 Documentation preview 📚:https://cpython-previews--133209.org.readthedocs.build/