1

I am new to javaScript and need to call a python function from it. This is the python function I would like to call.

#test.py
def intToNum(_num):
    _num = int(_num)
    A = ["zero","one","two","three","four","five","six","seven","eight","nine"]
    return A[_num]

It takes a number from 0-9 in the form of a string and returns it as the word for that number as a string.

The javaScript just needs to print the result. For answer purposes just hard code "3" as input from javaScript side.

4
  • 5
    Java is to Javascript as Pain is to Painting, or Ham is to Hamster. They are completely different. Commented Mar 25, 2019 at 0:08
  • Welcome to the site. Please edit your title to reflect javascript rather than java. Also, see how-to-ask to get ideas on how to get the most here. In particular, you will need to provide code details about your javascript. Commented Mar 25, 2019 at 0:14
  • 1
    Possible duplicate of Call python function from JS Commented Mar 25, 2019 at 0:30
  • Possible duplicate of Call Python function from Javascript code Commented Mar 25, 2019 at 1:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.