This is the varia library website work in progress.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

27 lines
652 B

import csv
import os
script_dir = os.path.dirname(__file__)
def parsecsv():
libcsv = open(os.path.join(script_dir, "varlib.csv"), "r")
with libcsv:
csv_as_dict = csv.DictReader(libcsv)
return csv_as_dict
def getpublications():
libcsv = open(os.path.join(script_dir, "varlib.csv"), "r")
with libcsv:
csv_as_dict = csv.DictReader(libcsv)
listofbooks = []
listofids = []
for row in csv_as_dict:
book = "{} - {}".format(row["Author"], row["Publication"])
listofbooks.append(book)
listofids.append(row["Id"])
return listofids, listofbooks
parsecsv()