3 ms·
How is if __name__ == "__main__": main() different from a main()?
by hota_mazi 10y ago
How is
if __name__ == "__main__":
main()
different from a main()?
- cookiecaper 10y agoIt's only needed if you're importing the file as a library/module somewhere.
- squeaky-clean 10y agoYou don't even need that. print("hello world") will run just fine
- coldtea 10y agoIt's different in that it's optional in Python.