I'm having trouble expanding my code to use on a folder of .csv's as opposed to just one file. I have written the code to read and manipulate a single file which starts with the following code and is putting data into 3 lists:
with open('Filename_raw.csv', 'r') as read_obj:
csv_reader = reader(read_obj)
list1 = []
list2 = []
list3 = []
for row in csv_reader:
if len(row) == 3:
list1.append(row)
if len(row) == 16:
list2.append(row)
if len(row) == 21:
list3.append(row)
...
...
...
I had to run through each csv line by line because of its structure(3 different tables in one csv)
I have a file path C:\Users\xxxx\xxxxxx\xxxxxx\xxxxxxxx
where the .csvs are located and so im hoping for some guidance on how to loop through all files in folder as opposed to just one.
Filenames are similarly structured and always end in "_raw.csv"
Any help would be much appreciated - Thanks!