0

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?

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by Paul Thompson
0

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.

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.