This tool allows to convert Python to javascript online. You can get the js code (ES6 or ES5) corresponding to your Python code.
You can see the user guide to help you.
How to convert Python code to Javascript:
This tool allows you to convert your python source code into javascript code. For this conversion it uses JavaScripthon, a Python 3 to ES6 JavaScript translator. And it uses Babel to convert ES6 to ES5, it is a JavaScript compiler.
JavaScripthon is a simple Python 3.5+ translator to JavaScript. It aims to be able to translate most of the Python's core semantics without providing a full python-in-js environment.
JavaScripthon does not handle everything yet, current todo list (As of this writing):
If you choose es5, then it uses babel to convert es6 code to es5.
Why convert Python code to Javascript ?
As many developers develop in Python, we may have snippets of Python code that we would like to run in a browser or on the server side via nodejs.
It can also be useful for those who do not know python better than javascript.
This allows for example to see the code corresponding to certain instructions in python.
If you find other reasons to do this type of code conversion, you can let me know in a comment (I am curious).
If you find a bug or think of interesting options, please indicate it in a comment.
Comments
a-2022-02-15 20:26