[New-bugs-announce] [issue35816] csv.DictReader, skipinitialspace does not ignore tabs
André Lehmann
report at bugs.python.org
Thu Jan 24 05:28:34 EST 2019
New submission from André Lehmann <andre.lehmann at siemens.com>:
When using the csv.DictReader a dialect can be given to change the behavior of interpretation of the csv file.
The Dialect has an option "skipinitialspace" which shall ignore the whitespace after the delimiter according to the documentation (https://docs.python.org/3/library/csv.html).
Unfortunately this works only for spaces but not for tabs which are also whitespaces.
See the following code snippet applied on the attached file:
with open("conf-csv", "r") as csvfile:
csv.register_dialect("comma_and_ws", skipinitialspace=True)
csv_dict_reader = csv.DictReader(csvfile, dialect="comma_and_ws")
for line in csv_dict_reader:
print(line)
The second line shall not contain "\t" chars.
----------
files: conf.csv
messages: 334289
nosy: andre.lehmann
priority: normal
severity: normal
status: open
title: csv.DictReader, skipinitialspace does not ignore tabs
type: behavior
versions: Python 3.5
Added file: https://bugs.python.org/file48075/conf.csv
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35816>
_______________________________________
More information about the New-bugs-announce
mailing list