How do you write specific data to an HTML table?

how to write a list of data in HTML table using python

  • I have build up a HTML table and want to write data using python code. Here is the code: <body> <h1 align="center">EXAMPLE</h1> <table style="width:100%"> <tr> <th width="17%" height="70">XYZ</th> <th width="37%">XYZ</th> <th width="16%">XYZ</th> <th width="16%">XYZ</th> <th width="14%">XYZ</th> </tr> </table> I want to enter the table data using strings and using python code. Is it possible to enter the data?? *Here these XYZ values shall be replaced by using string.

  • Answer:

    May be this helps my_string = 'whatever you want' with open('my.html') as html: html_data = html.read() with open('new.html', 'w') as new_html: new_html.write(html_data.replace('XYZ', my_string))

user5241812 at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.