Re: [Tutor] Tutor Digest, Vol 38, Issue 10

2007-04-06 Thread Jay Mutter III
> > > "Jay Mutter III" <[EMAIL PROTECTED]> wrote > > >> Whether I attempt to just strip the string or attempt to >> >> if line.endswith('No.\r'): >> line = line.rstrip() >> >> It doesn't work. > > Ca

Re: [Tutor] Tutor Digest, Vol 38, Issue 2

2007-04-05 Thread Jay Mutter III
- > > Message: 4 > Date: Sun, 1 Apr 2007 16:46:05 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Tutor Digest, Vol 38, Issue 1 > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain;

Re: [Tutor] Tutor Digest, Vol 38, Issue 1

2007-04-01 Thread Jay Mutter III
t/plain; format=flowed; charset="iso-8859-1"; > reply-type=original > > > "Jay Mutter III" <[EMAIL PROTECTED]> wrote > >> for line in s: >> jay = patno.findall(line) >> jay2 = "".join(jay[0]) >> print jay2 >>

Re: [Tutor] Another parsing question

2007-03-31 Thread Jay Mutter III
in a certain pattern? For instance, if line ends with the abbreviation No. I want to join the current line with next line. Are lists immutable or can they be changed? Thanks again jay On Mar 31, 2007, at 2:27 PM, Kent Johnson wrote: > Jay Mutter III wrote: >> I have the following that

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 &qu

[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

Re: [Tutor] Tutor Digest, Vol 37, Issue 63

2007-03-25 Thread Jay Mutter III
ot; > > Message: 2 > Date: Sat, 24 Mar 2007 19:25:10 -0400 > From: Jay Mutter III > Subject: [Tutor] parsing text > [...] > 1.) when i do readlines and create a list and then print the list it > adds a blank line between every line of text > [...] > ideas? >

[Tutor] parsing text

2007-03-24 Thread Jay Mutter III
place(s,'p.','\n') in an attempt to put a CR in but it just put the characters\n in the string. ideas? Thanks again jay Jay Mutter III wrote: > Thanks for the response > Actually the number of lines this returns is the same number of lines > given when i put it

[Tutor] Parsing text file with Python

2007-03-23 Thread Jay Mutter III
Script i have to date is below and Thanks to your help i can see some daylight but I still have a few questions 1.) Are there better ways to write this? 2.) As it writes out the one group to the new file for companies it is as if it leaves blank lines behind for if I don't have the elif len

Re: [Tutor] Why is it...

2007-03-23 Thread Jay Mutter III
gt; f.close() >>> Note the differing placement of the f.close() statement, it's not part of the while. On 3/22/07, Kent Johnson <[EMAIL PROTECTED]> wrote: Jay Mutter III wrote: > Why is it that when I run the following interactively > > f = open('Patents-1920.txt

Re: [Tutor] Another string question

2007-03-23 Thread Jay Mutter III
Andre; Thanks again for the assistance. I have corrected the splitlines error and it works ( well that part of anyway) correctly now. On Mar 23, 2007, at 5:30 AM, Andre Engels wrote: 2007/3/22, Jay Mutter III <[EMAIL PROTECTED]>: I wanted the following to check each line and if it e

Re: [Tutor] Should I use python for parsing text?

2007-03-23 Thread Jay Mutter III
First thanks for all of the help I am actually starting to see the light. On Mar 22, 2007, at 7:51 AM, Kent Johnson wrote: > Jay Mutter III wrote: >> Kent; >> Thanks for the reply on tutor-python. >> My data file which is just a .txt file created under WinXP by an >>

Re: [Tutor] Another string question

2007-03-23 Thread Jay Mutter III
On Mar 23, 2007, at 5:30 AM, Andre Engels wrote: 2007/3/22, Jay Mutter III <[EMAIL PROTECTED]>: I wanted the following to check each line and if it ends in a right parentheses then write the entire line to one file and if not then write the line to anther. It wrote all of the ) to one fi

[Tutor] Another string question

2007-03-22 Thread Jay Mutter III
I wanted the following to check each line and if it ends in a right parentheses then write the entire line to one file and if not then write the line to anther. It wrote all of the ) to one file and the rest of the line (ie minus the ) to the other file. in_filename = raw_input('What is the

[Tutor] Why is it...

2007-03-22 Thread Jay Mutter III
Why is it that when I run the following interactively f = open('Patents-1920.txt') line = f.readline() while line: print line, line = f.readline() f.close() I get an error message File "", line 4 f.close() ^ SyntaxError: invalid syntax but if i run it in a script there is no

[Tutor] Should I use python for parsing text

2007-03-20 Thread Jay Mutter III
"Jay Mutter III" wrote > See example next: > A.-C. Manufacturing Company. (See Sebastian, A. A., > and Capes, assignors.) >... >Aaron, Solomon E., Boston, Mass. Pliers. No. 1,329,155 ; >Jan. 27 ; v. 270 ; p. 554. > > For instance, I would like to go to end of

[Tutor] Should I use python for parsing text

2007-03-11 Thread Jay Mutter III
I am using an intel iMac with OS -X 10.4.8. It has Python 2.3.5. My issue is that I have a lot of text ( about 500 pages at the moment) that I need to parse so that I can eliminate info I don't need, break the remainder into fields and put in a database/spreadsheet. See example next: A.-C.