Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'character,': 0.07; 'delimiter': 0.09; 'cc:addr:python-list': 0.10; 'thread': 0.11; '-tkc': 0.16; 'csv': 0.16; 'expects': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message- id:@tim.thechases.com': 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; 'subject:File': 0.16; 'subject:Text': 0.16; 'superfluous': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'module': 0.19; 'trying': 0.21; 'monday,': 0.23; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'values': 0.26; 'cc:addr:gmail.com': 0.27; 'file': 0.32; 'print': 0.32; 'extract': 0.33; 'values.': 0.33; 'problem': 0.33; 'text': 0.34; 'table': 0.35; 'data.': 0.36; 'should': 0.36; 'possible': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'august': 0.66; 'fin': 0.84; 'nagy': 0.84; 'received:50.22': 0.84; 'subject:From': 0.97 Date: Wed, 05 Sep 2012 11:25:02 -0500 From: Tim Chase 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: Ramchandra Apte Subject: Re: Extract Text Table From File References: <481dc39d-1dee-4ebe-97d5-ccad659f8c74@googlegroups.com> <9187c848-9b47-45e3-815f-9bb44bbc66d1@googlegroups.com> In-Reply-To: <9187c848-9b47-45e3-815f-9bb44bbc66d1@googlegroups.com> 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: Huso , python-list@python.org 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346862235 news.xs4all.nl 6990 [2001:888:2000:d::a6]:47605 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28520 [trimming out a bunch of superfluous text so the thread is actually readable] On 09/05/12 08:08, Ramchandra Apte wrote: > On Monday, 27 August 2012 15:42:14 UTC+5:30, Laszlo Nagy wrote: >> On 2012-08-27 11:53, Huso wrote: >>> I am trying to extract some text table data from a log file >> >> fin = open("test.txt","r") >> >> for line in fin: >> >> # This is one possible way to extract values. >> >> values = line.strip().split() >> >> print values > > the csv module should be used for this not regex The problem is that the csv module expects a single delimiter character, not columnar data. -tkc