Ifindthatitdoesn'tmatterhowIset 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):
In words, csv.reader() doesn't find a lineterminator when it reads the second "line" of the list so it reads another line where it does find a lineterminator. I get a line break after word4 even though no lineterminator appears there.
I'm using Python 2.3 on Linux 2.4.23.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I posted this query on usenet before I found this forum, but I haven't gotten an adequate response yet.
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']
['word3', 'word4']
['word5', 'word6']
['word7', 'word8']
Ifindthatitdoesn'tmatterhowIset 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):
word1 word2;word3 word4
word5 word6;word7 word8
Also, if I use as input_data:
['word1\tword2;', 'word3\tword4', 'word5\tword6;', 'word7\tword8;']
I expect to get
word1 word2
word3 word4word5 word6
word7 word8
In words, csv.reader() doesn't find a lineterminator when it reads the second "line" of the list so it reads another line where it does find a lineterminator. I get a line break after word4 even though no lineterminator appears there.
I'm using Python 2.3 on Linux 2.4.23.