Change file path for quotes

From quotes/author/title/quotes.csv
To quotes/author/title.csv
This commit is contained in:
Jessica L. Hacker 2019-09-20 08:26:21 -07:00
parent f7f14090ed
commit 8ceb2d05c3

View file

@ -23,7 +23,7 @@ shutil.rmtree('quotes')
for quote in quotes: for quote in quotes:
# path: ./quotes/author/work/ # path: ./quotes/author/work/
path = 'quotes/' + quote[1] + '/' + quote[3] + '/' path = 'quotes/' + quote[1] + '/'
# https://stackoverflow.com/a/600612/11736197 # https://stackoverflow.com/a/600612/11736197
try: try:
@ -34,6 +34,7 @@ for quote in quotes:
else: else:
raise raise
with open(path + 'quotes.csv', 'a') as csvfile: # file path: ./quotes/author/title.csv
writer = csv.writer(csvfile, delimiter=',', quotechar='`') with open(path + quote[3] + '.csv', 'a') as csvfile:
writer = csv.writer(csvfile, delimiter=',', quotechar='`', quoting=csv.QUOTE_ALL)
writer.writerow(quote) writer.writerow(quote)