python The entry function is 【if name == “main”】,【print(name)】 Print is 【main】, That is, when a module is called as a whole , Module name 【name】 The value of is 【main】.
import time
def func():
print("666")
if __name__ == "__main__":
print("hello,world!")
func()
print(__name__)
print(time.__name__)
Output
D:\PycharmProjects\test\venv\Scripts\python.exe D:/PycharmProjects/test/enter.py
hello,world!
666
__main__
time