[Tutor] Comparing lines in two files, writing result into a third file
stuart_clemons@us.ibm.com
stuart_clemons@us.ibm.com
Wed Apr 23 14:12:09 2003
This is a multipart message in MIME format.
--=_alternative 0064353985256D11_=
Content-Type: text/plain; charset="US-ASCII"
Hi Danny:
Thanks for replying. Let me preface my response by saying I'm basically a
Python newbie. I got into Python a little bit about a year ago, but then
was pulled away to do other things. I'm now being asked to do some things
where I think Python will be very useful. So, I'm trying to learn as I
go, but I gotta produce stuff fairly quickly and I don't have a lot of
spare time to spend on my learning curve. I do like Python though, and
I'm glad I have something to use it for.
So, anyway, now that I think about it a little bit, perhaps sorted order
doesn't really matter. One responder suggested that I use dictionaries in
my code structure. My understanding is that dictionaries are mappings,
not sequences, so I guess ordering is not really relevant here. FWIW, It
does turn out that the files I'm working with are always ordered
sequentially when I get them.
Concerning dictionaries, do you think dictionaries is the structure to use
? If so, I'll try to spend some time reading up on dictionaries. I do
remember having problems reading a file into a dictionary when I tried it
a year ago or so.
TIA.
- Stuart
Danny Yoo <dyoo@hkn.eecs.berkeley.edu>
04/23/2003 01:14 PM
To: stuart_clemons@us.ibm.com
cc: "R. Alan Monroe" <amonroe@columbus.rr.com>,
<tutor@python.org>
Subject: Re: [Tutor] Comparing lines in two files, writing
result into a third file
On Wed, 23 Apr 2003 stuart_clemons@us.ibm.com wrote:
> Yes, that's the good news ! The input files will always be sorted.
Hi Stuart,
Can you talk a little more about why having the input files sorted is a
good thing? This is not a silly question, but is meant to help you focus
on a particular part of the problem: there's something about the sorting
that makes this "merging" problem particularly nice.
[By the way, Stuart's problem is similar to the Unix utility 'comm', which
also requires that its inputs are in sorted order.]
Good luck to you!
--=_alternative 0064353985256D11_=
Content-Type: text/html; charset="US-ASCII"
<br><font size=2 face="sans-serif">Hi Danny:</font>
<br>
<br><font size=2 face="sans-serif">Thanks for replying. Let me preface
my response by saying I'm basically a Python newbie. I got into Python
a little bit about a year ago, but then was pulled away to do other things.
I'm now being asked to do some things where I think Python will be very
useful. So, I'm trying to learn as I go, but I gotta produce stuff
fairly quickly and I don't have a lot of spare time to spend on my learning
curve. I do like Python though, and I'm glad I have something to
use it for. </font>
<br>
<br><font size=2 face="sans-serif">So, anyway, now that I think about it
a little bit, perhaps sorted order doesn't really matter. One responder
suggested that I use dictionaries in my code structure. My understanding
is that dictionaries are mappings, not sequences, so I guess ordering is
not really relevant here. FWIW, It does turn out that the files I'm
working with are always ordered sequentially when I get them.</font>
<br>
<br><font size=2 face="sans-serif">Concerning dictionaries, do you think
dictionaries is the structure to use ? If so, I'll try to spend some time
reading up on dictionaries. I do remember having problems reading
a file into a dictionary when I tried it a year ago or so.</font>
<br>
<br><font size=2 face="sans-serif">TIA. </font>
<br><font size=2 face="sans-serif"> </font>
<br><font size=2 face="sans-serif">- Stuart</font>
<br><font size=2 face="sans-serif"> </font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<td><font size=1 face="sans-serif"><b>Danny Yoo <dyoo@hkn.eecs.berkeley.edu></b></font>
<p><font size=1 face="sans-serif">04/23/2003 01:14 PM</font>
<td><font size=1 face="Arial"> </font>
<br><font size=1 face="sans-serif"> To:
stuart_clemons@us.ibm.com</font>
<br><font size=1 face="sans-serif"> cc:
"R. Alan Monroe" <amonroe@columbus.rr.com>,
<tutor@python.org></font>
<br><font size=1 face="sans-serif"> Subject:
Re: [Tutor] Comparing lines in two files,
writing result into a third file</font></table>
<br>
<br>
<br><font size=2><tt><br>
<br>
On Wed, 23 Apr 2003 stuart_clemons@us.ibm.com wrote:<br>
<br>
<br>
> Yes, that's the good news ! The input files will always be sorted.<br>
<br>
Hi Stuart,<br>
<br>
<br>
Can you talk a little more about why having the input files sorted is a<br>
good thing? This is not a silly question, but is meant to help you
focus<br>
on a particular part of the problem: there's something about the sorting<br>
that makes this "merging" problem particularly nice.<br>
<br>
<br>
[By the way, Stuart's problem is similar to the Unix utility 'comm', which<br>
also requires that its inputs are in sorted order.]<br>
<br>
<br>
Good luck to you!<br>
<br>
</tt></font>
<br>
--=_alternative 0064353985256D11_=--