转载:https://stackoverflow.com/questions/419163/what-does-if-name-main-do When your script is run by passing it as a command to the Python interpreter, python myscript.py all of the code that is at indentation level 0 gets executed. Functions and class…