Re: Looping issues

2007-04-06 Thread thebjorn
On Apr 5, 8:01 pm, [EMAIL PROTECTED] wrote: > What I am trying to do is compare two files to each other. > > If the 2nd file contains the same line the first file contains, I want > to print it. I wrote up the following code: > > correct_settings = open("C:\Python25\Scripts\Output > \correct_settin

Re: Looping issues

2007-04-05 Thread Peter Otten
Larry Bates wrote: > If the files aren't terribly large (not tested): > > correct_lines=open(r"C:\Python25\Scripts\Output" \ > "\correct_settings.txt", "r").readlines() > > current_lines=open(r"C:\Python25\Scripts\Output\output.txt", > "r").readlines() >

Re: Looping issues

2007-04-05 Thread hlubenow
[EMAIL PROTECTED] wrote: > On Apr 5, 2:18 pm, "anglozaxxon" <[EMAIL PROTECTED]> wrote: >> On Apr 5, 2:01 pm, [EMAIL PROTECTED] wrote: >> >> >> >> > What I am trying to do is compare two files to each other. >> >> > If the 2nd file contains the same line the first file contains, I want >> > to prin

Re: Looping issues

2007-04-05 Thread Sick Monkey
Ooops, Sorry I left .lower() out. def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fname + ": " + str(detail))

Re: Looping issues

2007-04-05 Thread Sick Monkey
Try this. NOTE: The script below will compare lines of both files (even hidden characters such as \n)... def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fnam

Re: Looping issues

2007-04-05 Thread Hamilton, William
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 05, 2007 1:01 PM To: python-list@python.org Subject: Looping issues What I am trying to do is compare two files to each other. If the 2nd file contains the same line

Re: Looping issues

2007-04-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > What I am trying to do is compare two files to each other. > > If the 2nd file contains the same line the first file contains, I want > to print it. I wrote up the following code: > > > > correct_settings = open("C:\Python25\Scripts\Output > \correct_settings.txt",

Re: Looping issues

2007-04-05 Thread anglozaxxon
On Apr 5, 2:27 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > What I am trying to do is compare two files to each other. > > > If the 2nd file contains the same line the first file contains, I want > > to print it. I wrote up the following code: > > > correct_settings = o

Re: Looping issues

2007-04-05 Thread Larry Bates
[EMAIL PROTECTED] wrote: > What I am trying to do is compare two files to each other. > > If the 2nd file contains the same line the first file contains, I want > to print it. I wrote up the following code: > > > > correct_settings = open("C:\Python25\Scripts\Output > \correct_settings.txt","r"

Re: Looping issues

2007-04-05 Thread brochu121
On Apr 5, 2:18 pm, "anglozaxxon" <[EMAIL PROTECTED]> wrote: > On Apr 5, 2:01 pm, [EMAIL PROTECTED] wrote: > > > > > What I am trying to do is compare two files to each other. > > > If the 2nd file contains the same line the first file contains, I want > > to print it. I wrote up the following code:

Re: Looping issues

2007-04-05 Thread Collin Stocks
That *shouldn't* be the problem, since files are iterable On 5 Apr 2007 11:18:50 -0700, anglozaxxon <[EMAIL PROTECTED]> wrote: On Apr 5, 2:01 pm, [EMAIL PROTECTED] wrote: > What I am trying to do is compare two files to each other. > > If the 2nd file contains the same line the first file conta

Re: Looping issues

2007-04-05 Thread Collin Stocks
I don't know what is wrong with your code yet, but first you should clean it up. Either replace those backslashes with forward slashes, or put r before the first quote in the path string. This prevents special characters from being evaluated as such. Second, you should debug a little. Feel free t

Re: Looping issues

2007-04-05 Thread anglozaxxon
On Apr 5, 2:01 pm, [EMAIL PROTECTED] wrote: > What I am trying to do is compare two files to each other. > > If the 2nd file contains the same line the first file contains, I want > to print it. I wrote up the following code: > > correct_settings = open("C:\Python25\Scripts\Output > \correct_settin

Looping issues

2007-04-05 Thread brochu121
What I am trying to do is compare two files to each other. If the 2nd file contains the same line the first file contains, I want to print it. I wrote up the following code: correct_settings = open("C:\Python25\Scripts\Output \correct_settings.txt","r") current_settings = open("C:\Python25\Scri