[Tutor] CSV Module

Kent Johnson kent_johnson at skillsoft.com
Fri Aug 6 03:13:37 CEST 2004

This seems to be a limitation of the csv module. Or two limitations, maybe. 
First, it ignores the lineterminator parameter on reads - it is using the 
standard file iterator to break the input into lines. Second, I don't think 
it allows a newline inside a value.

This bug report has a little more detail about the first limitation: 


At 01:19 PM 8/5/2004 -0400, orbitz wrote:
>I'm trying to use the csv module to read in a file nicley. My dialect 
>looks like:
>class TabSep(csv.Dialect):
>  delimiter = '\t'
>  quotechar = '"'
>  escapechar = None
>  doublequote = True
>  skipinitialspace = True
>  lineterminator = '\r\n'
>  quoting = csv.QUOTE_MINIMAL
>My problem is, while reading the file, one of the parts of it has a ^M on 
>it so I get:
>_csv.Error: newline inside string
>Why is csv even complaining about this? I don't care what's in there, I 
>tell it what to use as line terminator. Is there any way around this?
>Tutor maillist  -  Tutor at python.org

More information about the Tutor mailing list