Files
code_snippets/Python-Patreon-CSV/parse_csv.py
T
2017-07-25 23:12:16 -06:00

27 lines
567 B
Python

import csv
html_output = ''
names = []
with open('patrons.csv', 'r') as data_file:
csv_data = csv.DictReader(data_file)
# We don't want first line of bad data
next(csv_data)
for line in csv_data:
if line['FirstName'] == 'No Reward':
break
names.append(f"{line['FirstName']} {line['LastName']}")
html_output += f'<p>There are currently {len(names)} public contributors. Thank You!</p>'
html_output += '\n<ul>'
for name in names:
html_output += f'\n\t<li>{name}</li>'
html_output += '\n</ul>'
print(html_output)