Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'ascii': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; '"new': 0.16; '(file': 0.16; 'csv': 0.16; 'equivalents': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'separator,': 0.16; 'terms).': 0.16; 'detect': 0.17; '(in': 0.18; 'sort': 0.21; 'recognize': 0.22; 'changes,': 0.23; 'header': 0.24; "we'd": 0.24; 'creating': 0.26; 'expand': 0.26; 'guess': 0.27; 'header:X-Complaints-To:1': 0.28; 'represent': 0.28; 'record': 0.28; 'maybe': 0.29; 'fri,': 0.30; 'expect': 0.31; 'structure': 0.32; 'could': 0.32; '+0200,': 0.33; 'url:home': 0.33; 'to:addr :python-list': 0.33; 'excel': 0.33; 'there': 0.35; 'received:org': 0.36; 'method': 0.36; 'subject:with': 0.36; 'should': 0.36; 'charset:us-ascii': 0.36; 'two': 0.37; '(for': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'subject:-': 0.40; 'header:Received:5': 0.40; 'course.': 0.62; 'incorporate': 0.65; 'jul': 0.65; 'dialect': 0.84; 'dennis': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Odd csv column-name truncation with only one column Date: Fri, 20 Jul 2012 14:09:13 -0400 Organization: > Bestiaria Support Staff < References: <5008110d$0$6865$e4fe514c@news2.news.xs4all.nl> <50084B81.50909@tim.thechases.com> <50098e6c$0$6880$e4fe514c@news2.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-253-104-34.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1342807755 news.xs4all.nl 6983 [2001:888:2000:d::a6]:54268 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:25699 On Fri, 20 Jul 2012 18:59:24 +0200, Hans Mulder declaimed the following in gmane.comp.python.general: > The sniffer will always guess '\r\n' as the line terminator. > > That should not stop you from creating a dialect with '\x1E' as > the line terminator. Just don't expect the sniffer to recognize > that dialect. > {devil's advocate}: Maybe it's time to expand the CSV module... Of course, if we set it to recognize x1E as a record separator, we should be fair and also incorporate the other two ASCII "separator" codes. x1D (group separator) could be used to signal a "new table" -- ie; a change in record structure (number of columns, header labels). And then x1C (file separator) could represent a new "worksheet" (in Excel terms). We'd need some sort of flag/query method to detect these changes, of course. while not csv.EndOfSheet(): while not csv.EndOfTable(): ... And then there is the potential of using and as equivalents for x1D and x1C (for those files using and as field/record separators). -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/