时间:2021-07-01 10:21:17 帮助过:70人阅读
Py1.py
代码如下:
#!/usr/bin/env python
def test():
print '__name__ = ',__name__
if __name__ == '__main__':
test()
代码如下:
#!/usr/bin/env python
import Py1.py
def test():
print '__name__ = ',__name__
if __name__ == '__main__':
test()
print ‘Py1.py __name__ = ',Py1.__name__
代码如下:
__name__=__main__
Py1.py __name__=Py1
代码如下:
if __name__ == '__main__':
test()