summaryrefslogtreecommitdiffstats
path: root/Lib/csv.py
diff options
context:
space:
mode:
authorSkip Montanaro <skip@pobox.com>2005-12-28 15:37:25 (GMT)
committerSkip Montanaro <skip@pobox.com>2005-12-28 15:37:25 (GMT)
commit91bb70c5c07c2e73535638df2baadb302d9d71d2 (patch)
tree1e9d4be34eb15ca7a78232ddc7065da820be12ff /Lib/csv.py
parente08fa29d0e5bf02006ae30d79c31a6fd02d62068 (diff)
downloadcpython-91bb70c5c07c2e73535638df2baadb302d9d71d2.zip
cpython-91bb70c5c07c2e73535638df2baadb302d9d71d2.tar.gz
cpython-91bb70c5c07c2e73535638df2baadb302d9d71d2.tar.bz2
Fix for problem with Sniffer class. If your delimiter is whitespace and the
last field was empty it would strip the delimiter and incorrectly guess that "" was the delimiter. Reported in c.l.py by Laurent Laporte. Will backport.
Diffstat (limited to 'Lib/csv.py')
-rw-r--r--Lib/csv.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/csv.py b/Lib/csv.py
index 14b4d17..7516380 100644
--- a/Lib/csv.py
+++ b/Lib/csv.py
@@ -271,7 +271,7 @@ class Sniffer:
for char in ascii:
metaFrequency = charFrequency.get(char, {})
# must count even if frequency is 0
- freq = line.strip().count(char)
+ freq = line.count(char)
# value is the mode
metaFrequency[freq] = metaFrequency.get(freq, 0) + 1
charFrequency[char] = metaFrequency