Skip to content

Instantly share code, notes, and snippets.

@JayantGoel001
Created January 9, 2021 21:31
Show Gist options
  • Save JayantGoel001/31abd3e578b4c42c6f586445f4f46009 to your computer and use it in GitHub Desktop.
Save JayantGoel001/31abd3e578b4c42c6f586445f4f46009 to your computer and use it in GitHub Desktop.
Convert JavaScript Code to python code using js2py
import js2py
log = "console.log('Hello World');"
pr = js2py.eval_js(log)
pr
func = '''function add(a,b){
return a+b;
}'''
a = int(input("Enter a: "))
b = int(input("Enter b: "))
d = js2py.eval_js(func)
print(d(a, b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment