tags:

views:

97

answers:

2

I have simple python script, 'first.py':

#first.py
def firstFunctionEver() :
    print "hello"

firstFunctionEver()

I want to call this script using : python first.py and have it call the firstFunctionEver(). But, the script is ugly -- what function can I put the call to firstFunctionEver() in and have it run when the script is loaded?

+3  A: 
if __name__ == '__main__':
    firstFunctionEver()
Ken
+9  A: 
if __name__ == "__main__":
    firstFunctionEver()

Read more at the docs here.

Steve