csv file:
by the way, 'excel' is just name of one of the available dialects in csv module. I didn't think it's excel file
import csv def filter_csv(csv_file): reader = csv.DictReader(csv_file) return set((row['part_number'], row['product_serial_number']) for row in reader) @upload_csv_blueprint.route('/upload_csv', methods=['GET','POST']) @login_required def upload_file(): if request.method == 'POST': csvfile = request.files['file'] for product in filter_csv(csv_file=csvfile): print(','.join(product))tested with
with open('products.csv') as csvfile: for product in filter_csv(csv_file=csvfile): print(','.join(product))
Output:04X-1101-0116,1633-0001
04X-1101-0114,1633-0002
04X-1101-0112,1633-0021
04X-1101-0113,1633-0050
04X-1101-0115,1633-0020
by the way, 'excel' is just name of one of the available dialects in csv module. I didn't think it's excel file
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs