diff --git a/Lib/csv.py b/Lib/csv.py index cd202659873811..7fda6c1e89414a 100644 --- a/Lib/csv.py +++ b/Lib/csv.py @@ -121,7 +121,7 @@ class excel(Dialect): delimiter = ',' quotechar = '"' doublequote = True - skipinitialspace = False + skipinitialspace = True lineterminator = '\r\n' quoting = QUOTE_MINIMAL register_dialect("excel", excel) diff --git a/Misc/NEWS.d/next/C_API/2025-01-16-17-00-30.gh-issue-128921.rAIMai.rst b/Misc/NEWS.d/next/C_API/2025-01-16-17-00-30.gh-issue-128921.rAIMai.rst new file mode 100644 index 00000000000000..9980e546ae7a33 --- /dev/null +++ b/Misc/NEWS.d/next/C_API/2025-01-16-17-00-30.gh-issue-128921.rAIMai.rst @@ -0,0 +1,5 @@ +Set `skipinitialspace` to True by default in csv.py + +The default value of `skipinitialspace` in `csv.py` has been changed to `True`, aligning with common user preferences and improving ease of use when parsing CSV files with leading spaces. + +Patch by Logan Wright. ([GH-128921](https://github.com/python/cpython/pull/128921))