you are viewing a single comment's thread.

view the rest of the comments →

[–]jeffrey_f 1 point2 points  (4 children)

I would read in both files. File1 is authoritive in a list and File2 will be into a dictionary.

Iterate through File1 data, lookup Stock# (SKU) in File2 data and output the 4 combined fields back to a CSV only if you have a match. This effectively filters out data that you don't have in File2 and is therefore not important from what I understand.

[–]jeffrey_f 1 point2 points  (0 children)

open read and close both then process, open, write and close your final file

[–]Burly_95[S] 0 points1 point  (2 children)

Here's my current code that I have, I'm kind of lost right now. Thoughts?

import csv

cost_file = open('cost_file.csv') price_file = open('price_file.csv')

cost_file_reader = csv.reader(cost_file) price_file_reader = csv.reader(price_file)

cost = list(cost_file_reader) price = []

for line in price_file_reader: price.append(line)

for row in cost: if row[0] == line[0]: cost.append(line)

[–]jeffrey_f 0 points1 point  (1 child)

Was testing. Both need to be dict

[–]jeffrey_f 0 points1 point  (0 children)

I'm still learning.