CSV ignores lineterminator

J

Jeffrey Barish

With

input_data = ['word1\tword2;word3\tword4;',
'word5\tword6;word7\tword8;']

and

delimiter = '\t'
lineterminator = ';'

shouldn't csv.reader(input_data, dialect='mydialect') return

['word1', 'word2']

as the first row? I find that it doesn't matter how I set
lineterminator, csv always terminates at the end of the line returned
by the iterable object passed as its first argument (input_data, in
this case). I must be missing something basic here.

I may be confused about the interaction between what iterable object
defines as the next row and what csv.reader defines as the next row.
The documentation for csv says that the line returned by csv.reader can
span multiple input lines. I assume that this would happen if the
lineterminator is defined as something other than \n, in which case
csv.reader would keep pulling in lines until it finds the
lineterminator. This is not the behavior I am observing.

I'm using Python 2.3 on Linux 2.4.23.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top