How can I incorporate Python scripts into web pages?

Sparkery

I'm interested in having Python scripts in a web page. I'm planning simple scripts on the order of splitting strings and maybe a little bit more.

As in Javascript...

<html>
<script>
  //stuff goes here
</script>
</html>

Except I want to use Python in the exact same way, or at least in a remotely similar way. Is there any way to accomplish this without a framework?

If I need a framework in the end, which one is best?

Thanks in advance!

Paul

No...Generally, you can't include a python script in <script></script> tags.

Why not? Python isn't one of the scripting languages built into the visitors' browsers, like Javascript, or commonly installed as a plug-in like Java or Flash. There may very well be a Python plug-in somewhere, but it is not in common use. Asking someone to install a plug in, even Java or Flash, to view your site is considered a hassle and security risk by many.

The usual way to run python for web page generation is server-side, but you are not asking about that, so how could it run browser-side? The answer is the python interpreter must be written in an available browser language like Javascript or Java.

And surprise!, there is a Python interpreter written in Javascript (Skulpt)! Since this runs Python in Javascript, it does not require any plugin and would be visible to most visitors. You will need the skulpt code and probably can't use <script> tags but could locate the python code in an visitor-editable <textarea> input according to the skulpt instructions.

There is a more well-known variant of Python one written in Java (Jython applet example) but your visitors would need to have the Java browser plugin installed for it to be usable.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How can I create dynamic CONTAO pages?

분류에서Dev

In rails, how can I incorporate external api calls tied to model create/update that do not trigger upon db:seed?

분류에서Dev

How can I alter livejs to run on PHP pages?

분류에서Dev

How can I stop pages from scrolling with an empty hyperlink jump?

분류에서Dev

How can I debug asp pages using IE Developer Tools?

분류에서Dev

How can I split a PDF's pages down the middle?

분류에서Dev

How do I set IDLE as the default editor for Python scripts?

분류에서Dev

How can I filter content of a web page?

분류에서Dev

Can I get data from my MSSql server and upload it to app engine via some python scripts?

분류에서Dev

Can I use PHP scripts in Firefox extension?

분류에서Dev

How do I turn off the annoying clicking sound when browsing web pages in Internet Explorer?

분류에서Dev

How can I generate gpg keys in scripts without leaving gpg-agent running?

분류에서Dev

How can I read all pages of an API response using aiohttp with discord.py?

분류에서Dev

How many pages can I print at once on my HP OfficeJet safely?

분류에서Dev

How can I find all wiki pages that link to a specific wiki page?

분류에서Dev

How can I make DropDownList retain selected value when navigating between pages

분류에서Dev

How can I build a custom distribution for running a simple web browser?

분류에서Dev

How can I link to a web page of another folder?

분류에서Dev

How can I replace bash with Python?

분류에서Dev

How can I convert a string into a function in Python?

분류에서Dev

How can i find overlapping times in python

분류에서Dev

How can I improve this code in python?

분류에서Dev

How can I install a newer python on Trusty?

분류에서Dev

How can I install Python 2.6 on 12.04?

분류에서Dev

How can I make my script in /etc/profile.d to run after all other scripts in same directory?

분류에서Dev

Simpy; how to incorporate an unknown amount of interrupts

분류에서Dev

How can I remove python 2.7 after installing python 3.3?

분류에서Dev

Where can I access man pages for "aptitude" if it is not on my system?

분류에서Dev

What kind of files I can use in GitHub Pages?

Related 관련 기사

  1. 1

    How can I create dynamic CONTAO pages?

  2. 2

    In rails, how can I incorporate external api calls tied to model create/update that do not trigger upon db:seed?

  3. 3

    How can I alter livejs to run on PHP pages?

  4. 4

    How can I stop pages from scrolling with an empty hyperlink jump?

  5. 5

    How can I debug asp pages using IE Developer Tools?

  6. 6

    How can I split a PDF's pages down the middle?

  7. 7

    How do I set IDLE as the default editor for Python scripts?

  8. 8

    How can I filter content of a web page?

  9. 9

    Can I get data from my MSSql server and upload it to app engine via some python scripts?

  10. 10

    Can I use PHP scripts in Firefox extension?

  11. 11

    How do I turn off the annoying clicking sound when browsing web pages in Internet Explorer?

  12. 12

    How can I generate gpg keys in scripts without leaving gpg-agent running?

  13. 13

    How can I read all pages of an API response using aiohttp with discord.py?

  14. 14

    How many pages can I print at once on my HP OfficeJet safely?

  15. 15

    How can I find all wiki pages that link to a specific wiki page?

  16. 16

    How can I make DropDownList retain selected value when navigating between pages

  17. 17

    How can I build a custom distribution for running a simple web browser?

  18. 18

    How can I link to a web page of another folder?

  19. 19

    How can I replace bash with Python?

  20. 20

    How can I convert a string into a function in Python?

  21. 21

    How can i find overlapping times in python

  22. 22

    How can I improve this code in python?

  23. 23

    How can I install a newer python on Trusty?

  24. 24

    How can I install Python 2.6 on 12.04?

  25. 25

    How can I make my script in /etc/profile.d to run after all other scripts in same directory?

  26. 26

    Simpy; how to incorporate an unknown amount of interrupts

  27. 27

    How can I remove python 2.7 after installing python 3.3?

  28. 28

    Where can I access man pages for "aptitude" if it is not on my system?

  29. 29

    What kind of files I can use in GitHub Pages?

뜨겁다태그

보관