Call Python function from Javascript code -


I want to call the Python function to Javascript because There is no option in javascript for whatever I want. Is this possible? Can you adjust the snippet below to work?

Javascript part:

  var tag = document.getElementsByTagName ("p") [0]; Text = tag.inner HTML; // Here I would like to call Python Interpreter with Python Function arrOfStrings = openSomehowPythonInterpreter ("~ / pythoncode.py", "Process paragraph (text)"); ~ / Pythoncode.py   

contains functions that use advanced libraries, which are not easy to write in JavaScript,

  import nltk # javascript Not in the DEF process paragraph (text): ... nltk calls ... returns LST # returns the list of strings (this will be converted to 'javascript' array)    

You only need to unplug your python Terrorism is a customizable Ajax request. You can do this with jquery, or just use javascript

  $ Ajax ({type: "POST", url: "~ / pythoncode.py", data: {param: text}}) .done (function (o) {// do something});    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -