0

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 :)

4
Contributors
4
Replies
31
Views
4 Years
Discussion Span
Last Post by pyTony
0

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.

0
try:
        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)
        sys.exit(2)



    can anyone convert this to javascript
0

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

0

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.