So, I need to review some pages, and made a janky queue for efficiency. I have a CSV that needs to be opened to be read, and one to be written to. For each page I open from the read CSV, I call input(), and write some notes, so that they can be saved to the csv to be written to. Code below.
with open("readfile.csv") as r:
csv_file = csv.DictReader(r)
with open("writefile.csv", 'w') as w:
headers = {'URL': None, 'JUDGEMENT': None}
writer = csv.DictWriter(w, fieldnames=headers)
writer.writeheader()
for row in csv_file:
url = row.get("Profile URL")
browser.get(url) //Selenium opening URL
judgement = input("What say you?")
writer.writerow({"Profile URL": url, "JUDGEMENT": judgement})
This works just fine when I do the entire CSV, but sometimes, I only want to do half. When I do CTRL+Z to escape the script, none of the write file saves. I tried adding an exception for the input like
try:
judgement = input("What say you?")
except Exception e:
//but can't find what to put here
That doesn't work, since I can't seem to find what to put here.