Re: [Tutor] Another parsing question

2007-03-31 Thread Alan Gauld
"Jay Mutter III" <[EMAIL PROTECTED]> wrote > for line in s: > jay = patno.findall(line) > jay2 = "".join(jay[0]) > print jay2 > > and it prints fine up until line 111 which is a line that had > previously returned [ ] since a number didn't exist on that line and > then exits with > I

Re: [Tutor] Another parsing question

2007-03-31 Thread Jay Mutter III
Kent; Again thanks for the help. i am not sure if this is what you menat but i put for line in s: jay = patno.findall(line) jay2 = "".join(jay[0]) print jay2 and it prints fine up until line 111 which is a line that had previously returned [ ] since a number didn't exist on that

Re: [Tutor] Another parsing question

2007-03-31 Thread Andrei
Hello Jay, Jay Mutter III wrote: > but still haven't gotten he first one. > >> for line in s: >> jay = patno.findall(line) >> print jay >> >> which yields the following >> >> [('1', '337', '912')] >> [('1', '354', '756')] >> if i try to write to a file instead of print to the screen usi

Re: [Tutor] Another parsing question

2007-03-31 Thread Kent Johnson
Jay Mutter III wrote: > I have the following that I am using to extract "numbers' from a file > ... > which yields the following > > [('1', '337', '912')] > ... > So what do i have above ? A list of tuples? Yes, each line is a list containing one tuple containing three string values. > How do

Re: [Tutor] Another parsing question

2007-03-31 Thread Jay Mutter III
Ok after a minute of thought I did solve my second question by simply changing my RE to (r'(\d{1}[\s,.]+\d{3}[\s,.]+\d{3})') but still haven't gotten he first one. On Mar 31, 2007, at 1:39 PM, Jay Mutter III wrote: > I have the following that I am using to extract "numbers' from a file > > >

[Tutor] Another parsing question

2007-03-31 Thread Jay Mutter III
I have the following that I am using to extract "numbers' from a file prompt1 = raw_input('What is the file from which you would like a list of patent numbers? ') p1 = open(prompt1,'rU') s = p1.readlines() prompt2 = raw_input('What is the name of the file to which you would like to save