浅析python 中__name__ = '__main__' 的作用
很多新手刚开始学习python的时候经常会看到python 中__name__ = \'__main__\' 这样的代码,可能很多新手一开始学习的时候都比较疑惑,python 中__name__ = '__main__' 的作用,到底干嘛的?
有句话经典的概括了这段代码的意义:
“Make a script both importable and executable”
意思就是
转载
2017-06-06 12:56:40 ·
318 阅读 ·
0 评论