on-internet
← Community

Print a python output to an html file

Stack Overflow ·

I am writing a script to print the output to an html file. I am stuck on the format of my output. Below is my code: def printTohtml(Alist): myfile = open('zip_files.html', 'w') html = """<html> <head></head> <body><p></p>{htmlText}</body> </html>""" title = "Study - User - zip file - Last date modified" myfile.write(html.format(htmlText = title)) for newL in Alist: for j in newL: if j == newL[-1]: myfile.write(html.format(htmlText=j)) else: message = j + ', ' myfile.write(html.format(htmlText = message)) myfile.close() Alist = [['123', 'user1', 'New Compressed (zipped) Folder.zip', '05-24-17']

Comments

Sign in or sign up to comment and upvote.

No comments yet.