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.

behold
  • 538
  • 5
  • 19
SamHay
  • 11
  • 2
  • 5
    Java is to Javascript as Pain is to Painting, or Ham is to Hamster. They are completely different. – CertainPerformance Mar 25 '19 at 00:08
  • Welcome to the site. Please edit your title to reflect javascript rather than java. Also, see [how-to-ask](https://stackoverflow.com/help/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. – mhhollomon Mar 25 '19 at 00:14
  • 1
    Possible duplicate of [Call python function from JS](https://stackoverflow.com/questions/32288722/call-python-function-from-js) – Jack Bashford Mar 25 '19 at 00:30
  • Possible duplicate of [Call Python function from Javascript code](https://stackoverflow.com/questions/13175510/call-python-function-from-javascript-code) – Pablo Mar 25 '19 at 01:01

0 Answers0