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
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()
>
[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
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))
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
-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
[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",
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
[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"
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:
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
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
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
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
14 matches
Mail list logo