#8: Python if __name__ == ’__main__’ | Python Best Practices
Step by step video tutorials to learn Python for absolute beginners!
You might have encountered the statement if __name__ == “__main__“ a lot while coding in Python.
In this video, you will learn about the special __name__ attribute of a Python file and how it can be used to run the file dynamically in different contexts.
~
Run Python Online:
Programs in this video:
Python if __name__ == “__main__“ (text-based tutorial):
Watch our videos and revise them with our Python App!
Download here for Android:
Download here for iOS:
Timestamps:
0:00 Intro
0:16 What is __name__ in Python?
0:30 Running a Python File as a Script
1:34 Running a Python File as a Module
2:48 Using if conditional with __name__
Find Programiz elsewhere:
Facebook:
8 views
15
4
1 month ago 00:33:06 2
Сатанизм. 10 Интересных Фактов
3 months ago 00:10:20 1
Кодинг стал ИЗИ после этого открытия! Вот как я это сделал!
3 months ago 05:27:42 1
Python — полный курс для начинающих. Этот навык изменит твою жизнь.