Hello,

I'm new to python and I'm trying to learn how to read/write programs written in python using eclipse. I'm used to java so a lot of things are familiar but a lot of things aren't and I'm having trouble finding a good place to go to learn what different methods do (like the java api for java).

For example I'm looking at a program and I see what the main method is:

def main (args):

But at the bottom of the program it says:

if __name__ == "__main__":
    main(sys.argv)

What does that line mean? Is there a good reference for beginners that you could recommend to guide me through writing a simple program?

Recommended Answers

All 3 Replies

I understand that main(sys.argv) calls the main method and provides (sys.argv) as argument. This I found out with a few google searches except things look a little different, some code I've looked at has an asterisk on the parameter, not quite sure what that means.

Be a part of the DaniWeb community

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