📜  pythonpreventing import from execution without call - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:04.686000             🧑  作者: Mango

代码示例1
# stuff to run always here such as class/def
def main():
    pass

if __name__ == "__main__":
   # stuff only to run when not called via 'import' here
   main()