Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

call function with python

You need to install js2py or requests-html packages to run the JavaScript program from Python

//example :
//javaScript function : squareofNum()
code in python : 
import js2py

squareofNum = "function f(x) {return x*x;}"

result = js2py.eval_js(squareofNum)

print(result(5))
>>output : 25
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #call #function #python
ADD COMMENT
Topic
Name
9+1 =