[New-bugs-announce] [issue7350] csv doesn't handle escaped characters properly
Eric Torstenson
report at bugs.python.org
Wed Nov 18 20:11:55 CET 2009
New submission from Eric Torstenson <e_torstenson at hotmail.com>:
When I use CSV with a separator, if there is an escaped separator in the
field, it causes the next field to become part of the current one:
file = csv.reader(open(filename), delimiter='\t', quotechar="'")
for words in file:
print words[0-8]
If, say line 3 contains: '1709' 'PF01322' 'Cytochrom_C_2'
'Cytochrome_C_2; ' 'Cytochrome C\'' 'Finn RD, Bateman A' 'anon' 'Sarah
Teichmann'
Column 4 will be printed as:
Cytochrome C\'\tFinn RD, Bateman A'
I've checked this with a spreadsheet application, and it opened this
line just fine, but when I used csv to parse, I had to remove that
escaped single quote to get my columns to work out properly for that line.
----------
components: Extension Modules
messages: 95441
nosy: est_python_tracker
severity: normal
status: open
title: csv doesn't handle escaped characters properly
type: behavior
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7350>
_______________________________________
More information about the New-bugs-announce
mailing list