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

Recommended Answers

All 4 Replies

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.