Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!selfless.tophat.at!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'rules.': 0.07; 'csv': 0.09; 'descriptor': 0.09; 'prerequisite': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'output': 0.11; 'broken': 0.12; 'wed,': 0.13; 'bieber': 0.16; 'declaimed': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'received:mindspring.com': 0.16; 'received:wlfraed': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'algorithm': 0.16; 'entries': 0.16; 'repeated': 0.19; 'trying': 0.23; '-0700': 0.23; 'url:home': 0.25; 'lee': 0.28; 'module': 0.30; 'andy': 0.30; 'that...': 0.30; "won't": 0.32; 'list': 0.33; 'skip:" 20': 0.33; 'source': 0.33; 'entry': 0.33; 'header:X-Complaints-To:1': 0.34; 'to:addr:python- list': 0.34; 'quite': 0.34; 'certain': 0.36; 'file': 0.36; 'charset:us-ascii': 0.36; 'bother': 0.37; 'some': 0.37; 'received:org': 0.38; 'subject:: ': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'format': 0.40; 'hope': 0.60; 'more': 0.60; 'jun': 0.67; 'spaces': 0.73; 'dennis': 0.77; 'barnes': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Python Regular Expressions Date: Wed, 22 Jun 2011 21:50:22 -0700 Organization: > Bestiaria Support Staff < References: <3b65fd1f-d377-49b8-b00a-f80462a1213d@35g2000prp.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: user-11faedd.dsl.mindspring.com 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: 26 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308804908 news.xs4all.nl 14139 [::ffff:82.94.164.166]:33338 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8263 On Wed, 22 Jun 2011 07:00:42 -0700 (PDT), Andy Barnes declaimed the following in gmane.comp.python.general: > > I have a source file in csv format that follows certain rules. I So why not use the CSV module to read&split the fields... > It's quite a complicated find and replace operation that can be broken > down into some easy stages. The main thing the sample above showed was > that some of the entries won't list any prerequisits - these only need > the descriptor entry creating. Some of them have more than one > prerequisite. A line is needed for each prerequisite listed, linking > it to it's parent. > That's output formatting, I won't bother trying to create an algorithm for that... > You can also see that the 'name' needs to have spaces removed and it's > repeated a few times in the process. I Hope it's easy to see what I am strippedName = "".join(originalName.split()) -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/