csv.Sniffer

class csv.Sniffer[source]

“Sniffs” the format of a CSV file (i.e. delimiter, quotechar) Returns a Dialect object.

Methods

__init__()
_guess_delimiter(data, delimiters) The delimiter /should/ occur the same number of times on each row.
_guess_quote_and_delimiter(data, delimiters) Looks for text enclosed between two identical quotes (the probable quotechar) which are preceded and followed by the same character (the probable delimiter).
has_header(sample)
sniff(sample[, delimiters]) Returns a dialect (or None) corresponding to the sample