#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
5 days ago 00:35:49 54
Как устроен и функционирует Дата-центр. Для нас открыли все двери в ЦОДе Greenbush dc
6 months ago 00:33:06 4
Сатанизм. 10 Интересных Фактов
8 months ago 00:10:20 0
Кодинг стал ИЗИ после этого открытия! Вот как я это сделал!
8 months ago 05:27:42 0
Python — полный курс для начинающих. Этот навык изменит твою жизнь.
8 months ago 03:14:48 0
Из АДА к ВЕРШИНАМ. Прошлое БМВ, которое хотели ЗАБЫТЬ.
8 months ago 01:21:46 0
Тестировщик с нуля до senior QA инженер - Роман Цакунов @rvtsakunov
8 months ago 00:20:28 0
Самое БОЛЬШОЕ МЕТРО в МИРЕ! Вся ПРАВДА о Китайском МЕТРОПОЛИТЕНЕ..