Confused with two keywords:

This question already has an answer here:

  • What does if __name__ == “__main__”: do? 23 answers

  • __name__ will give you the name of the current module and module which is used when you say

    python prog.py
    

    __name__ in prog.py would now be __main__ . This has been explained in python docs here

    链接地址: http://www.djcxy.com/p/9326.html

    上一篇: 为什么一些python脚本以这种方式声明main()?

    下一篇: 与两个关键字混淆: