Skip to content

Instantly share code, notes, and snippets.

@tharmann
Created May 11, 2023 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tharmann/c263568615eb3ff6e8497bd63e75873f to your computer and use it in GitHub Desktop.
Save tharmann/c263568615eb3ff6e8497bd63e75873f to your computer and use it in GitHub Desktop.
wc-prod-ex-csv-reader.py
import csv
with open('wc-product-export-10-5-2023-1683750652005 - wc-product-export-10-5-2023-1683750652005.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count == 0:
line_count += 1
else:
col_count = 0
for column in row:
if column == 'Genus Species':
scientific_name = col_count + 1
print(row[0] + ',' + '"' + row[scientific_name] + '"')
col_count += 1
line_count += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment