What is if __name__ == '__main__' (in Python) - #python
Original Post: https://www.jcchouinard.com/python-if-name-equals-main/ if name equals main is a construct that uses a control flow statement to allow you to execute code only when the Python script is run and not when it is imported as a module. ----- Install Python: - MacOS: https://www.jcchouinard.com/install-python-on-macos/ - Windows: https://www.jcchouinard.com/install-python-on-windows/ - Anaconda: https://www.jcchouinard.com/install-python-with-anaconda-on-windows/ Subscribe to my Python Course waitlist: https://ba995fe7.sibforms.com/serve/MUIEAPv50TFkNuoknCNvzRUKLLhvvZd5jzCwEZvi9BNjtkhVuEtLpEG58-Khdquyg9v5V-1qeGDwIXy739I4eFIVcCqeqqV3UUisW_-hAd5ljC1dGMrQvXHC7JvORh9TbnLA1CHqWro4N7YVZ4730-D5dXGxqd3CbaVHSJpS5fyylPMVzCe1_y9xOTl2-CsvEuhO01E0Ytv59HEJ Support my work: https://www.buymeacoffee.com/jcchouinard Subscribe to this channel: https://www.youtube.com/channel/UCthJJqyUGdI5EA0YjnjXthw?sub_confirmation=1 Follow me: https://twitter.com/ChouinardJC