What are __init__.py and __main__ used for?

Entry Python

Answer

__init__.py marks a folder as a package.
__main__ allows a script to run directly using main block.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice