varia-library-website/library/csvparser/csvparser.py

25 lines
521 B
Python
Raw Normal View History

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 = []
for row in csv_as_dict:
listofbooks.append(row["Publication"])
return listofbooks
parsecsv()