I have a while loop that works really well (it does what it's supposed to). When I run the while loop and have it write it's generated dataframe to .CSV it work no problem and keeps looping (albeit overwriting the .CSV file)
But I'm trying to figure out how to write the df to a new file (with a variable generated name) each time the loop runs. I can't seem to get this figured out.
Does anyone have a suggestion?
f = open('ActionLogLinks.csv')
csv_f = csv.reader(f)
action_log_links = []
for column in csv_f:
action_log_links.append(column[1])
cand_ref = []
for column in csv_f:
cand_ref.append(column[0])
position = 0
while position <len(action_log_links):
browser.get(action_log_links[position])
for cand in cand_ref:
filename="Loop_Test"+"_"+str(cand_ref)+".csv"
df.to_csv(filename, index=False)
position = position + 1