Python Casts Tutorial #4 - What Does If __name__ == '__main__' Mean?

Published: 29 May 2018
on channel: Oleg Molchanov
67,728
3.3k

My courses:
Boosty:
https://boosty.to/omolchanov/posts/99...

Patreon:
  / karty-vsekh-41011404  

What does the if _name_ == '__main__' construct mean? What is the _name_ variable, why is it needed, and how to use it.

Just in case:
It's two underscores, one in front and one in back.

** SOURCE CODE **
The main projects are available on Patreon:
  / iskhodnyi-kod-26640469  
***

------

🔷 For donations. Always very grateful for this:
https://www.donationalerts.ru/r/omolc...

------

Continuation of the Python tutorial series for beginners. The series covers specific topics in Python programming.

★ Important:

How to read Python Traceback:
   • Как читать Traceback Python  

Dealing with errors using two broken parsers:
   • Python: работа с ошибками на примере нераб...  

★ All Python casts:

1 - What you need to know about Pip
   • Уроки Python Casts # 1 - Что вам нужно зна...  

2 - Environment variables. Usage.
   • Уроки Python casts # 2 - Переменные окруже...  

#3 - What do *args, **kwargs mean?
   • Уроки Python casts # 3 - Что означает *arg...  

#4 - if __name __ == '__main__': what does this mean?
   • Уроки Python casts #4 - if __name  __ == '...  

#5 - List Comprehensions
   • Уроки Python casts #5 - Генераторы списков...  

#6 - Decorators
   • Уроки Python casts #6 - Декораторы  

#7 - 5 Techniques You Might Not Know
   • Уроки Python casts #7 - 5 приемов, о котор...  

#8 - Closures
   • Уроки Python casts #8 - Замыкания  

#9 - What is try... except...
   • Уроки Python casts #9 - Что такое try - ex...  

#10 - What is yield
   • Уроки Python casts #10 - Что такое yield  

#11 - How does the map() function work?
   • Уроки Python casts #11 - Как работает функ...  

#12 - How does the filter() function work?
   • Уроки Python casts #12 - Как работает функ...  

#13 - Else clause in For and While loops
   • Уроки Python casts #13 - Else у циклов For...  

★ Playlists:

Django 2.x:
   • Уроки Django 2.x  

Flask:
   • Создание блога на Flask (уроки)  

Telegram bots:
   • Telegram боты на Python  

Working with the VKontakte API:
   • Работа с API Вконтакте (vk.com) на Python  


On this page of the site you can watch the video online Python Casts Tutorial #4 - What Does If __name__ == '__main__' Mean? with a duration of hours minute second in good quality, which was uploaded by the user Oleg Molchanov 29 May 2018, share the link with friends and acquaintances, this video has already been watched 67,728 times on youtube and it was liked by 3.3 thousand viewers. Enjoy your viewing!