Re: identifying and parsing string in text file

2008-03-09 Thread [EMAIL PROTECTED]
On 8 mar, 20:49, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have a large file that has many lines like this, > > name="DoseReferenceStructureType">SITE > > I would like to identify the line by the tag (300a,0014) and then grab > the name (DoseReferenceStructureType) and value (SITE). It's

Re: identifying and parsing string in text file

2008-03-08 Thread Paul McGuire
On Mar 8, 2:02 pm, Nemesis <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I have a large file that has many lines like this, > > > > name="DoseReferenceStructureType">SITE > > > I would like to identify the line by the tag (300a,0014) and then grab > > the name (DoseReferenceStructureTy

Re: identifying and parsing string in text file

2008-03-08 Thread Nemesis
[EMAIL PROTECTED] wrote: > I have a large file that has many lines like this, > > name="DoseReferenceStructureType">SITE > > I would like to identify the line by the tag (300a,0014) and then grab > the name (DoseReferenceStructureType) and value (SITE). > > I would like to create a file that woul

Re: identifying and parsing string in text file

2008-03-08 Thread Bernard
Hey Brian, It seems the text you are trying to parse is similar to XML/HTML. So I'd use BeautifulSoup[1] if I were you :) here's a sample code for your scraping case: from BeautifulSoup import BeautifulSoup # assume the s variable has your text s = "whatever xml or html here" # turn it into a