1

I have a college assignment to make a simple website. I have a html website with a table and I also have a python program that scrapes another website. It then writes this data to a text file. The data consists of numbers with one number per line and about 28 numbers total.

Basically I would like the data from the python script to be displayed in the HTML table. I have looked for solutions online, however I am limited to using HTML, CSS and JavaScript as this is what the assignment is asking for. Any help on how to go about this?

1
  • 1
    break it into bite-sized chunks. first be able to update a single cell with a hard-coded number. Then figure how to update cells in each row with the same number. then figure how to load the text file into an array from ajax. then find how to feeds that array to your all-row updater. Commented Jun 6, 2020 at 21:16

2 Answers 2

0

This depends on what framework you are using. I know Flask, so if you are using Flask, try this:

In Python:

return render_template("myFile.html", items=myItemsList)

In HTML Using jinja2:

{% for item in items %}
<td>{{item}}</td>
{% endfor %}
Sign up to request clarification or add additional context in comments.

Comments

0

This is pretty easy if you are using python and a framework like Flask or Django to display the data on the web. However, if you are actually limited to using HTML, CSS and Javascript for the viewable website then you'll need to focus on Javascript as the method for reading the text file.

There are some good answers for that here: How to read text file in JavaScript and here Read a local text file using Javascript

Hopefully that helps :)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.