Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Neil Cerutti Newsgroups: comp.lang.python Subject: Re: Python Regular Expressions Date: 22 Jun 2011 14:58:51 GMT Organization: Norwich University Lines: 23 Message-ID: <96ee9bFlrrU1@mid.individual.net> References: <3b65fd1f-d377-49b8-b00a-f80462a1213d@35g2000prp.googlegroups.com> <77c4973c-7315-4b4d-8eae-3f5770dfb530@22g2000prx.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: individual.net TVksBEv1kuEPILwgkO9x8wfN38gkHEPvUoak7/TMOqzsYD2ijo Cancel-Lock: sha1:xgOu2nl3MhFZpQmIjnB8fgVFqSo= User-Agent: slrn/0.9.9p1/mm/ao (Win32) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8214 On 2011-06-22, Andy Barnes wrote: > to expand. I have parsed one of the lines manually to try and break > the process I'm trying to automate down. > > source: > Theurgic Lore, Lore, n/a, 105, 70, 30, Distil Mana > > output: > TheurgicLore [label="{ Theurgic Lore |{Lore|n/a}|{105|70|30}}"]; > DistilMana -> TheurgicLore; > > This is the steps I would take to do this conversion manually: It seems to me that parsing the file into an intermediate model and then using that model to serialize your output would be easier to understand and more robust than modifying the csv entries in place. It decouples deciphering the meaning of the data from emitting the data, which is more robust and expansable. The amount of ingenuity required is less, though. ;) -- Neil Cerutti