Alan Gauld wrote:
> On 14/02/15 09:55, Peter Otten wrote:
>
>> with open(headerfile) as f:
>> lookup_header = {
>> headerdata[:6]: headerdata.rstrip("\n") for headerdata in f}
>>
>> Then you can iterate over the lines in linefile, extract the key from
>> that and look it up in the d
Joel Goldstick wrote:
> You can dispense with the slicing if you use the str.split() method. It
> will put each item in a list.
Only if there are no whitespace chars in the field.
OT:
Joel, your comments are already quoted when you first post them. Something
is broken in your workflow.
___
On Sat, Feb 14, 2015 at 8:03 AM, Alan Gauld
wrote:
> On 14/02/15 09:55, Peter Otten wrote:
>
> with open(headerfile) as f:
>> lookup_header = {
>> headerdata[:6]: headerdata.rstrip("\n") for headerdata in f}
>>
>> Then you can iterate over the lines in linefile, extract the key fro
On 14/02/15 09:55, Peter Otten wrote:
with open(headerfile) as f:
lookup_header = {
headerdata[:6]: headerdata.rstrip("\n") for headerdata in f}
Then you can iterate over the lines in linefile, extract the key from that
and look it up in the dict:
with open(linefile) as lines, op
street.swee...@mailworks.org wrote:
> Hello all,
>
> Basically what I have here is header and line data for sales or purchase
> orders, and I'm trying to do a sql-like join to bring them together
> (which ultimately I did because I couldn't figure this out :)). I've
> managed to get the files in
Hello all,
Basically what I have here is header and line data for sales or purchase
orders, and I'm trying to do a sql-like join to bring them together
(which ultimately I did because I couldn't figure this out :)). I've
managed to get the files into python using string slicing, that's not a
prob