在PyCharm中,只需要敲出main,然后回车,PyCharm就会自动会补全if __name__ == '__main__'。
__name__ 是模块的一个私有属性。当前运行的模块的名字都为:__main__即,作为被导入的模块时,不会被运行。