I'm trying to have this program use all of the CSV files inside of a folder. The folder is on my desktop, and it's called "Web_Scraper" (I'm on a mac btw).
This is how the code looks; what do I replace whatever is inside of the "enumerate" with (the 1.csv, 2.csv, 3.csv, etc)?
from openpyxl import Workbook
import csv
import os
wb = Workbook()
ws = wb.worksheets[0]
header_keys = []
for n, fName in
enumerate(['3.csv','4.csv','5.csv','6.csv','7.csv','8.csv','9.csv','10.csv','11.csv','12.csv',]):
with open(fName) as fh:
csv_reader = csv.DictReader(fh, fieldnames=['header', 'data'], delimiter=',')
if n == 0:
for values in csv_reader:
I think I'm supposed to use something like os.listdir but I'm not exaclty sure what the syntax should be.