Skip to content
Snippets Groups Projects
Commit feb8cef7 authored by Mohammed Ahmed's avatar Mohammed Ahmed
Browse files

Update html_writer.py

parent a47b7c34
No related branches found
No related tags found
No related merge requests found
......@@ -20,8 +20,10 @@ def read_csv(filename):
result = []
with open(filename) as csvfile:
### EDIT BELOW HERE ###
row=[]
reader = csv.reader(csvfile, delimiter=";")
pass
for row in reader:
result.append(row)
### EDIT ABOVE HERE ###
return result
......@@ -38,10 +40,11 @@ def csv_to_html(csvdata):
"""
htmlstring = ""
### EDIT BELOW HERE ###
htmlline = "<tr><td>{}</td><td>{}</td><td>{}</td></tr>\n"
pass
big_list=read_csv('test.csv')
for row in big_list:
htmlline = "<tr><td>{}</td><td>{}</td><td>{}</td></tr>\n"
htmlstring=htmlstring+htmlline
### EDIT ABOVE HERE ###
return htmlstring
......@@ -51,7 +54,13 @@ def combine_template_with_data(template_string, htmldata):
tabular data.
"""
### EDIT BELOW HERE ###
return ""
fullstring=""
i= ""
i=csv_to_html('test.csv')
with open('template.html','r',encoding='utf-8') as f:
reader=f.read()
fullstring=reader.replace('{}',i)
return fullstring
### EDIT ABOVE HERE ###
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment