python入口函數是【if name == “main”】,【print(name)】打印的是【main】,也就是說當一個模塊被當做一個整體調用的時候,模塊名【name】的值是【main】。
import time
def func():
print("666")
if __name__ == "__main__":
print("hello,world!")
func()
print(__name__)
print(time.__name__)
輸出
D:\PycharmProjects\test\venv\Scripts\python.exe D:/PycharmProjects/test/enter.py
hello,world!
666
__main__
time
Recently, I received a network
The terminal input has been so