I need to convert python code to javascript. do anyone here know javascript? please give your mail id i will sent the python code to your mail!

thanks in advance :)

5 Years
Discussion Span
Last Post by pyTony

This is not how we do things around here. First, you give us your attempt at solving the problem you're dealing with, and than you ask a speciffic question, related to your code and/or problem.

        print getopt.getopt(sys.argv[1:], 'u:a:s:', ['help', 'output='])
        opts, args = getopt.getopt(sys.argv[1:], 'u:a:s:', ['help', 'output='])
        print opts, args,'print'
    except getopt.GetoptError, err:
        print str(err)

    can anyone convert this to javascript

Assuming that you are running the Javascript in a browser rather than as a stand-alone program, then the answer is 'no'. The example code above reads a set of arguments from the shell, something which Javascript cannot do - the closest equivalent would be reading data from the web page's POST or GET.

Mind you, there is no reason to convert this to Javascript, as it only reads from the command line and echos back the options. It is a more or less pointless program, or more likely, a fragment of a program taken out of context.

Edited by Schol-R-LEA


I do not see where and why you would use command line options in javascript and this can not be translated as the action happens in python standard library module getopt.

Edited by pyTony

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.