I apologize. My question did not make sense.
Asked
Active
Viewed 374 times
1 Answers
1
You'll need a web server running. There are full-python web servers out there or you could make your own python code act as a server. Or you could use a PHP server and execute the python script with it, but if you've never done PHP I don't think it'll be advantageous.
EDIT:
I'd probably use the php exec function instead, as you can pass it an array.
<?PHP
$output = [];
exec("python myScript.py", $output);
// the $output array now contains all lines printed by the python script
?>
<p>
The solution was <?PHP echo $output[0]; ?>.
</p>
-
I think there might be a PHP server already running, if that makes things easier. If I use it to execute Python code, how do I pass input into the Python code and output back? – lala Mar 17 '15 at 15:14
-
@Sonya If the web page is serve by a PHP server, then you can put php code in your html pages if you put them in the server folder and change the extension to .php, and then this script should do the trick. You might have to replace "python" with the full path to the python interpreter. – Domino Mar 17 '15 at 15:49
-