Should I use a main() method in a simple Python script?

后端 未结 5 2171
Happy的楠姐
Happy的楠姐 2020-12-24 06:52

I have a lot of simple scripts that calculate some stuff or so. They consist of just a single module.

Should I write main methods for them and call them with the

5条回答
  •  情深已故
    2020-12-24 07:14

    For a good explanation of the purpose of Python's "main guard" idiom:

    What does if __name__ == "__main__": do?

提交回复
热议问题