Back to Browse

If __name__ == "__main__" (with animations) Python Tutorial

7.1K views
Jun 4, 2019
7:49

In this video we will look at the ubiquitous yet mysterious line of code, If __name__ == "__main__" that pops up in many Python scripts. When I first started, I was wondering why we use __name__ == __main__. If __name__ == "__main__" is actually a way to check if your script is a script or module. If you don't understand that, don't worry, everything is explained in the video. In this video, we will learn with clear examples why we use if __name__ == "__main__", what each of the components (__name__) and __main__ mean, I give clear examples with animations to show what this line means, as well as how to and when to use it and you should hopefully leave this video with a full grasp of the meaning behind the mysterious statment: if __name__ == "__main__" You can find the notebook here in my Python stuff repository (or can be found eventually): https://github.com/moondra2017/Python-Stuff

Download

1 formats

Video Formats

360pmp49.2 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

If __name__ == "__main__" (with animations) Python Tutorial | NatokHD