New submission from Eric Torstenson <e_torsten...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue7350>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to