I’m working on automatically generating a local HTML file, and all the relevant data that I need is in a Python script. Without a web server in place, I’m not sure how to proceed, because otherwise I think an AJAX/json solution would be possible.
Basically in python I have a few list and dictionary objects that I need to use to create graphs using javascript and HTML. One solution I have (which really sucks) is to literally write HTML/JS from within Python using strings, and then save to a file.
What else could I do here? I’m pretty sure Javascript doesn’t have file I/O capabilities.
Thanks.
You just need to get the data you have in your python code into a form readable by your javascript, right?
Why not just take the data structure, convert it to JSON, and then write a
.jsfile that your.htmlfile includes that is simplyvar data = { json: "object here" };