import

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Mon Dec 18 06:11:12 EST 2006


Gert Cuykens a écrit :
> I would like to lauch a server from outside the side package directory
> how do i specify a path with import

http://docs.python.org/tut/node8.html#SECTION008110000000000000000

(snip)


> if __name__ == '__main__':  # ??? dont know what is this for

When a module is used as a program (ie python myprog.py), the 
module-level magic variable '__name__' is set to main. If the module is 
imported by another  one, this variable is set to the name of the 
module. This allow a module to have different behaviours according to 
how it is used.



More information about the Python-list mailing list