Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!news.franciliens.net!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:text': 0.05; '(using': 0.07; 'subject:file': 0.07; 'string': 0.09; 'subject:into': 0.09; 'python': 0.11; '-tkc': 0.16; '16:10,': 0.16; 'attends': 0.16; 'csv': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'thursday,': 0.16; ':-)': 0.16; 'wrote:': 0.18; 'split': 0.19; 'written': 0.21; 'code,': 0.22; 'file.': 0.24; 'header:In-Reply- To:1': 0.27; 'tim': 0.29; 'chase': 0.31; 'something': 0.35; 'but': 0.35; 'otherwise.': 0.36; 'doing': 0.36; 'charset:us-ascii': 0.36; 'las': 0.37; 'to:addr:python-list': 0.38; 'anything': 0.39; 'to:addr:python.org': 0.39; "you're": 0.61; 'results': 0.69; 'career.': 0.84; 'received:50.22': 0.84; 'zhang': 0.84 Date: Wed, 5 Feb 2014 22:09:52 -0600 From: Tim Chase To: python-list@python.org Subject: Re: parse a csv file into a text file In-Reply-To: <6a865ea9-c3e3-486a-a43e-31a28b4ac3a6@googlegroups.com> References: <5c268845-003f-4e24-b27a-c89e9fbfcc6c@googlegroups.com> <6a865ea9-c3e3-486a-a43e-31a28b4ac3a6@googlegroups.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: tim@thechases.com 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-Get-Message-Sender-Via: boston.accountservergroup.com: authenticated_id: tim@thechases.com X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1391659752 news.xs4all.nl 2856 [2001:888:2000:d::a6]:60248 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:65507 On 2014-02-05 19:59, Asaf Las wrote: > On Thursday, February 6, 2014 2:46:04 AM UTC+2, Tim Chase wrote: > > On 2014-02-05 16:10, Zhen Zhang wrote: > > Asaf recommended using string methods to split the file. Keep > > doing what you're doing (using the csv module), as it attends to > > a lot of edge-cases that will trip you up otherwise. I learned > > this the hard way several years into my Python career. :-) =20 >=20 > i did not recommend anything :-)=20 =46rom your code, list_t =3D str_t.split(',') It might have been a short-hand for obtaining the results of a CSV row, but it might be better written something like list_t =3D csv.reader([str_t]) -tkc