title: Print a python output to an html file
body: <p>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:</p>
  
  <pre><code>def printTohtml(Alist):
      myfile = open('zip_files.html', 'w')
      html =  """&lt;html&gt;
      &lt;head&gt;&lt;/head&gt;
      &lt;body&gt;&lt;p&gt;&lt;/p&gt;{htmlText}&lt;/body&gt;
      &lt;/html&gt;"""
  
      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'],
  ['123', 'user2', 'Iam.zip', '05-19-17'], ['abcd', 'Letsee.zip', '05-22-17'],
  ['Here', 'whichTwo.zip', '06-01-17']]
  
  printTohtml(Alist)
  </code></pre>
  
  <p>I want my output to be like this:</p>
  
  <pre><code>Study - User - zip file -  Last date modified
  123, user1, New Compressed (zipped) Folder.zip, 05-24-17
  123, user2, Iam.zip, 05-19-17
  abcd, Letsee.zip, 05-22-17
  Here, whichTwo.zip, 06-01-17
  </code></pre>
  
  <p>But my code is giving me everything on its own line. Can anyone please help me?</p>
  
  <p>Thanks in advance for your help!</p>
  
  <p>My Output:</p>
  
  <pre><code>Study - User - zip file - Last date modified 
  
  123, 
  
  user1, 
  
  New Compressed (zipped) Folder.zip, 
  
  05-24-17 
  
  123, 
  
  user2, 
  
  Iam.zip, 
  
  05-19-17 
  
  abcd, 
  
  Letsee.zip, 
  
  05-22-17 
  
  Here, 
  
  whichTwo.zip, 
  
  06-01-17 
  </code></pre>