I make a connection with DB and select some information with a query in a python file. All information is stored in a variable. Then I start a js, but I want to send this information from python to the js file to use it there. Should I start the script like with some argument and how should I get it in the js file?
Asked
Active
Viewed 229 times
1
-
you might want to read about web frameworks like flask. – Florian H Jun 26 '19 at 13:00
-
4What exactly does that mean, "start a js"…? – deceze Jun 26 '19 at 13:10
1 Answers
0
Why not create an json
file that contain all your data ? Run your python script then update this json and finally call your js file that import this json
With es6 its easy to import a json in a js file :
import * as data from './example.json';

johannchopin
- 13,720
- 10
- 55
- 101
-
Sounds a bit messy for this, ie. reading from/writing to the filesystem. – Will Taylor Jun 26 '19 at 13:21
-
In keeping with UNIX traditions, the data should (optionally) simply be written to stdout and could be piped into the other program from there. – deceze Jun 26 '19 at 14:34