import csv import dataset def readTemplate(): upper_lines = '' with open('youtubeTable_upper.html',encoding='UTF-8') as f: upper_lines = f.readlines() lower_lines = '' with open('youtubeTable_lower.html',encoding='UTF-8') as f: lower_lines = f.readlines() return upper_lines, lower_lines upper_lines, lower_lines = readTemplate() dataLines = [] with open('youtubeReport.csv', newline='',encoding='UTF-8') as csvfile: rows = csv.reader(csvfile) for row in rows: dataLines.append('
') path = 'youtueTemplate.html' f = open(path, 'w',encoding='UTF-8') for l in upper_lines: f.write(l+'\n') for l in dataLines: f.write(l+'\n') for l in lower_lines: f.write(l+'\n') f.close() ''' '''