美文网首页
if __name__ == '__main__'

if __name__ == '__main__'

作者: 孔李聃丘 | 来源:发表于2017-07-19 14:10 被阅读0次

    When the Python interpreter reads a source file, it executes all of the code found in it.

    Before executing the code, it will define a few special variables. For example, if the python interpreter is running that module (the source file) as the main program, it sets the special name variable to have a value "main". If this file is being imported from another module, name will be set to the module's name.

    see this page to get more

    相关文章

      网友评论

          本文标题:if __name__ == '__main__'

          本文链接:https://www.haomeiwen.com/subject/haslkxtx.html