use dictreader
This commit is contained in:
parent
6803a2df86
commit
c7f4b47da0
@ -28,9 +28,7 @@ def get_vcinema_viewings(token_id, token_secret, viewings_csv=None, combine_repe
|
||||
viewings_csv = viewings_csv.decode("utf-8")
|
||||
viewings_csv_rows = viewings_csv.strip().split("\n")
|
||||
|
||||
headers = viewings_csv_rows.pop(0).split(",")
|
||||
csvreader = csv.reader(viewings_csv_rows, delimiter=',', quotechar='"')
|
||||
viewings = [dict(zip(headers, list(row))) for row in csvreader]
|
||||
viewings = list(csv.DictReader(viewings_csv_rows, quotechar='"'))
|
||||
|
||||
if combine_repeat_viewings:
|
||||
for viewing in viewings:
|
||||
|
Loading…
x
Reference in New Issue
Block a user