0

What Does if __name__ == "__main__" Mean in Python?

 9 months ago
source link: https://realpython.com/courses/if-name-main-python/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

What Does if __name__ == "__main__" Mean in Python?

You’ve likely encountered Python’s if __name__ == "__main__" idiom when reading other people’s code. You might have even used if __name__ == "__main__" in your own scripts. But did you use it correctly?

This line of code can seem a little cryptic, so don’t fret if you’re not completely sure what it does, why you might want it, and when to use it.

In this video course, you’ll learn all about Python’s if __name__ == "__main__" idiom.

What’s Included:

Downloadable Resources:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK