Techno Blender
Digitally Yours.

What does if __name__ == ”__main__” do in Python?

0 28


When and how a main method is executed in Python

Photo by Blake Connally on unsplash.com

If you are new to Python, you might have noticed that it is possible to run a Python script with or without a main method. And the notation used in Python to define one (i.e. if __name__ == ‘__main__') is definitely not self-explanatory especially for new comers.


When and how a main method is executed in Python

Photo by Blake Connally on unsplash.com

If you are new to Python, you might have noticed that it is possible to run a Python script with or without a main method. And the notation used in Python to define one (i.e. if __name__ == ‘__main__') is definitely not self-explanatory especially for new comers.

FOLLOW US ON GOOGLE NEWS

Read original article here

Denial of responsibility! Techno Blender is an automatic aggregator of the all world’s media. In each content, the hyperlink to the primary source is specified. All trademarks belong to their rightful owners, all materials to their authors. If you are the owner of the content and do not want us to publish your materials, please contact us by email – [email protected]. The content will be deleted within 24 hours.

Leave a comment