CSV ignores lineterminator

Discussion in 'Python' started by Jeffrey Barish, Apr 5, 2004.

  1. 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.
    --
    Jeffrey Barish
     
    Jeffrey Barish, Apr 5, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Teuvo Eloranta
    Replies:
    1
    Views:
    448
    Skip Montanaro
    Feb 5, 2004
  2. Michal Mikolajczyk
    Replies:
    0
    Views:
    658
    Michal Mikolajczyk
    Feb 13, 2004
  3. Skip Montanaro
    Replies:
    0
    Views:
    722
    Skip Montanaro
    Feb 13, 2004
  4. Tintin92
    Replies:
    1
    Views:
    1,715
    Andrew Thompson
    Feb 14, 2007
  5. jliu66
    Replies:
    0
    Views:
    516
    jliu66
    Oct 19, 2007
Loading...

Share This Page