Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34307
| References | <08080305078A3F47B751F7412214A051011B096BF3@MBX22.exg5.exghost.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2012-12-05 11:18 -0700 |
| Subject | Re: Help "joining" two files delimited with pipe character ("|") |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.514.1354731569.29569.python-list@python.org> (permalink) |
On Wed, Dec 5, 2012 at 10:57 AM, Daniel Doo <dd@topekacapitalmarkets.com> wrote: > I am new to Python. Is there a method to “join” two pipe delimited files > using a unique key that appears in both files? I would like to implement > something similar to the Unix join command. If the files are small enough to fit in virtual memory, load one of the files into a dict where the key is the join field and the value is the full line. Then iterate over the other file one line at a time, checking to see if the join field is in the dict. If it is, output the joined line. Otherwise, skip it.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Help "joining" two files delimited with pipe character ("|") Ian Kelly <ian.g.kelly@gmail.com> - 2012-12-05 11:18 -0700
csiph-web