It's an extract from stackOverflow answer: Very frankly speaking there is no such online tool or anything which can directly convert your python code to java code, and give you the exact desired result which you might have been getting from your python code. Memelord 0 11 Months Ago I also need to convert this code to Java.
Universal-transpiler is a source-to-source compiler that translates a small subset of several programming languages into several others. It is also able to translate several metasyntax notations, such as EBNF and ABNF. Universal-transpiler was written as an experimental “proof-of-concept,” so it can only translate relatively simple programs. The Python 3 code is slightly longer because it defaults to Unicode strings. Byte arrays - when printed - produce different output. Python 3.6 and later have the 'fstrings' which make the print statements more compact. Hopefully this will help with efforts to convert code from java to python. About Press Copyright Contact us Creators Advertise Developers Terms Privacy Policy & Safety How YouTube works Test new features Press Copyright Contact us Creators.
- Optional 'thank-you' note:
Here is what I have so far
- Optional 'thank-you' note:
- Optional 'thank-you' note:
Don't try to convert code like that. Write down what the code is supposed to do. Then you are probably better off programming it anew.
Say what goes wrong.
Make sure you use correct formatting. Why have you not used {} in the Java®? Why are you double‑spacing your code? Why is there a print instruction inside a loop in the Python and no print() statement at all in the Java®?
Java To Python Code Converter
- 1
- Optional 'thank-you' note:
Java To Python Converter Online
By contrast, here is the same function in python 3.7:
Notes:
Hopefully this will help with efforts to convert code from java to python.
Travis