Run python file -- what function is main? -


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

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

i want call script using : python first.py , have call firstfunctionever(). but, script ugly -- function can put call firstfunctionever() in , have run when script loaded?

if __name__ == "__main__":     firstfunctionever() 

read more @ docs here.


Comments

Popular posts from this blog

php - How to build a web site which gives a sub-domain dynamically to every registered user? -

android - View with visibility state GONE taking up space on screen -