GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — article/python/python_main.py at master · pythonpeixun/article Expand file tree/ Copy pathpython_main.pyMore file actions 13 lines (11 loc) · 506 Bytes / Copy pathpython_main.pyFile metadata and controls13 lines (11 loc) · 506 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 #这样理解python中的if __name__ == '__main__': 用图片说明python中的if __name__ == '__main__': 模块都有一个变量__name__,可以在模块中print __name__的值看来本模块独立执行的值为__main__, 被其它模块导入执行的值为该模块(foo.py)的名字foo. if语句有2个作用: 1、可以在这个if下测试函数或类。 2、防止模块被导入时,函数或类的代码被执行2次。     |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |