Carlos Grohmann <carlos.grohm...@gmail.com> wrote:
>
>Hi all, I'm using csv to read text files, and its working fine, except
>in two cases:
>
>- when there is only one line of text (data) in the file
>- when there is a blank line after the last data line

>    dialect = csv.Sniffer().sniff(sample) # Check for file format with
>sniffer.

csv.Sniffer uses heuristics to try to guess what the file format is.  In
order for those heuristics to work, the file must contain a sufficient
number of lines, and the lines must actually have information that allows
it to tell the difference between formats.

It has been my experience that csv.Sniffer is NEVER worth the trouble.  You
know what the format is.  Just embed the dialect yourself.
-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to