Re: doubt regarding main function

2005-04-07 Thread Laszlo Zsolt Nagy
if __name__ == '__main__': test() What is the advantage of this way calling a function. For example, you can have a python script that has this function: def search(keywords,engine='www.google.com') At the end of the script, you can have this: if __name__ == '__main__': import sys

doubt regarding main function

2005-04-07 Thread praba kar
Dear All, I have doubt regarding main function in Python. In Python we can create a function and we can call a function directly. (eg:) def test(): print 'main function test' I can call this function the following way eg) test() So why we need the below way of calling a fun