Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: if __name__ == '__main__' #14

Open
humingcheng opened this issue Sep 3, 2016 · 0 comments
Open

python: if __name__ == '__main__' #14

humingcheng opened this issue Sep 3, 2016 · 0 comments

Comments

@humingcheng
Copy link
Owner

humingcheng commented Sep 3, 2016

当在模块内执行时,name == 'main'
当在模块外执行时:name == 'module'
因此该语句用于判断本模块是自己在执行还是被导入执行

@humingcheng humingcheng changed the title python: __name__ == '__main__' python: if __name__ == '__main__' Sep 3, 2016
@humingcheng humingcheng reopened this Sep 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant