标签:
Py1.py
#!/usr/bin/env python def test(): print ‘__name__ = ‘,__name__ if __name__ == ‘__main__‘: test()
Py2.py
#!/usr/bin/env python import Py1.py def test(): print ‘__name__ = ‘,__name__ if __name__ == ‘__main__‘: test() print ‘Py1.py __name__ = ’,Py1.__name__
执行结果:
__name__=__main__
if __name__ == ‘__main__‘:
test()
标签:
原文地址:http://www.cnblogs.com/paulwinflo/p/4933569.html