471,873 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,873 software developers and data experts.

CSV ignores lineterminator


input_data = ['word1\tword2;word3\tword4;',


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.
Jeffrey Barish
Jul 18 '05 #1
0 923

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Teuvo Eloranta | last post: by
3 posts views Thread by googlegroups | last post: by
reply views Thread by Rokas Valantinas | last post: by
reply views Thread by No_Name | last post: by
5 posts views Thread by turnitup | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.