Kanish Anand
Kanish Anand

Reputation: 172

How can I run a python script on a website?

I want to run a Python program on a website opened in Chrome, like in case of JavaScript I can run my code in DevTools. How to do it in case of Python?

Actually what I want to do is that there is some website opened already on chrome and my python script(I have used selenium in the script) wants to do something on that site , How to do this. I don't want to open site also through script but open it manually and then run the script.How can I do this ?

Upvotes: 2

Views: 2128

Answers (2)

Nikola Lukic
Nikola Lukic

Reputation: 4248

You can try this link : https://jupyter.org .

But this is only to embedded system and jupyter provides output to the webpage. That output is generated but some server services not really in browser.

You can't run python code like javascript. You can’t run python in browser because it is not supported simple. Python is more like server languages. You can do anything just like with c++ in native form not web. Browsers are sandbox's. On web platform you can't go out of browser also you can't access with other language's.

Upvotes: 1

Alec
Alec

Reputation: 9575

Browsers don't natively support python. You'd have to run it on a server, which can be hard to set up.

This PHP code should work, although it's very insecure:

<?php
   $output =  exec('./file.py');
?>

Upvotes: 1

Related Questions