Nov-19-2021, 02:30 AM
Nov-19-2021, 07:43 AM
https://docs.python.org/3/library/__main__.html Wrote:a module can discover whether or not it is running in the top-level environment by checking its own __name__, which allows a common idiom for conditionally executing code when the module is not initialized from an import statement:
if __name__ == '__main__': # Execute when the module is not initialized from an import statement. ......