title: python : HTML table creation from dictionary items
body: <p>I am not much aware of HTML. I want to create a HTML table from my dictionary items. Below is my code and output.<strong>I want 'th html tag' key of dictionary  should be on left side and 'td html tag' value of key on right.</strong> </p>
  
  <p><a href="https://i.stack.imgur.com/fIbdW.png" rel="nofollow noreferrer">Output from my code </a></p>
  
  <pre><code>from testdatabase import DBhelper
  
  db=DBhelper()
  
  item=db.get_user("KASHIF IQBAL")
  print(item)
  
  dict1={'ID':item['id'],
  'NAME':item['NAME'],
  'Project':item['PROJECT_ID'],
  'SUBDATE':item['SUBMIT_DATE'],
  'ERM Month':item['ERM_MONTH'],
  'ERM_SUBMIT':item['ERM_SUBMIT'],
  'Claim Period':item['CLAIM_PERIOD'],
  'SITE Location':item['LOCATION'],
  'Trip Type':item['TRIP_TYPE'],
  'Expense Info':item['EXPENSE_INFO'],
  'Market claim AmtINR':item['MARKET_CLAIM_INR'],
  'Concur Claim AmtINR':item['CONCUR_CLAIM_INR'],
  'Market claim AmtEUR':item['MARKET_CLAIM_EUR'],
  'Concur claim AmtEUR':item['CONCUR_CLAIM_EUR']
  }
  
  f1=open("expense_test.html",'w')
  html = """&lt;html&gt;&lt;table border="1"&gt;"""
  for  data in dict1:
     html+="&lt;tr&gt;&lt;th&gt;"+data+"&lt;/th&gt;&lt;/tr&gt;".format(data)
     html += r"&lt;tr&gt;&lt;td&gt;"+str(dict1[data])+"&lt;/td&gt;&lt;/tr&gt;"
  html += "&lt;/table&gt;&lt;/html&gt;"
  f1.write(''.join(html))
  print(html)
  </code></pre>