Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25636
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'case.': 0.05; 'column': 0.07; 'filename': 0.07; 'matches': 0.07; 'predefined': 0.07; 'cc:addr:python-list': 0.10; ':-)': 0.13; 'file,': 0.15; '-tkc': 0.16; 'csv': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'included"': 0.16; 'message-id:@tim.thechases.com': 0.16; 'pipes': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'tabs': 0.16; 'wrote:': 0.17; 'documented': 0.17; 'tests': 0.18; 'code,': 0.18; 'define': 0.20; 'trying': 0.21; 'not,': 0.21; 'object.': 0.22; 'cc:2**0': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'pass': 0.25; 'least': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'checking': 0.27; 'easiest': 0.27; "doesn't": 0.28; '(perhaps': 0.29; "i'm": 0.29; 'towards': 0.32; 'problem': 0.33; 'likely': 0.33; 'really': 0.36; 'but': 0.36; 'data.': 0.36; 'subject:with': 0.36; 'should': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'subject:-': 0.40; 'think': 0.40; 'your': 0.60; 'first': 0.61; "you'll": 0.62; 'interest': 0.62; 'solve': 0.62; 'ever': 0.63; 'information': 0.63; 'dialect': 0.84; 'received:50.22': 0.84; 'sniffing': 0.84 |
| Date | Thu, 19 Jul 2012 13:01:37 -0500 |
| From | Tim Chase <python.list@tim.thechases.com> |
| User-Agent | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 |
| MIME-Version | 1.0 |
| To | Hans Mulder <hansmu@xs4all.nl> |
| Subject | Re: Odd csv column-name truncation with only one column |
| References | <mailman.2297.1342696862.4697.python-list@python.org> <5008110d$0$6865$e4fe514c@news2.news.xs4all.nl> |
| In-Reply-To | <5008110d$0$6865$e4fe514c@news2.news.xs4all.nl> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| X-Source | |
| X-Source-Args | |
| X-Source-Dir | |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2309.1342720836.4697.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1342720837 news.xs4all.nl 6891 [2001:888:2000:d::a6]:51701 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:25636 |
Show key headers only | View raw
On 07/19/12 08:52, Hans Mulder wrote: > Perhaps it should be documented that the Sniffer doesn't work > on single-column data. I think this would involve the least change in existing code, and go a long way towards removing my surprise. :-) > If you really need to read a one-column csv file, you'll have > to find some other way to produce a Dialect object. Perhaps the > predefined 'cvs.excel' dialect matches your data. If not, the > easiest way might be to manually define a csv.Dialect subclass. The problem I'm trying to solve is "here's a filename that might be comma/pipe/tab delimited, it has an 'email' column at minimum, and perhaps a couple others of interest if they were included" It's improbable that it's ONLY an email column, but my tests happened to snag this edge case. I can likely do my own sniffing by reading the first line, checking for tabs then pipes then commas (perhaps biasing the order based on the file-extension of .csv vs. .txt), and then building my own dialect information to pass to csv.DictReader It just seems unfortunate that the sniffer would ever consider [a-zA-Z0-9] as a valid delimiter. -tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Odd csv column-name truncation with only one column Tim Chase <python.list@tim.thechases.com> - 2012-07-19 06:21 -0500
Re: Odd csv column-name truncation with only one column Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-19 12:08 +0000
Re: Odd csv column-name truncation with only one column Hans Mulder <hansmu@xs4all.nl> - 2012-07-19 15:52 +0200
Re: Odd csv column-name truncation with only one column Tim Chase <python.list@tim.thechases.com> - 2012-07-19 13:01 -0500
Re: Odd csv column-name truncation with only one column Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-19 17:10 -0400
Re: Odd csv column-name truncation with only one column Hans Mulder <hansmu@xs4all.nl> - 2012-07-20 18:59 +0200
Re: Odd csv column-name truncation with only one column Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-20 14:09 -0400
Re: Odd csv column-name truncation with only one column Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-20 08:31 +0000
csiph-web