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

Veröffentlicht am: 29 Mai 2018
auf dem Kanal: 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  


Auf dieser Seite können Sie das Online-Video Python Casts Tutorial #4 - What Does If __name__ == '__main__' Mean? mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Oleg Molchanov 29 Mai 2018 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 67,728 Mal angesehen und es wurde von 3.3 tausend den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!