+ 1

if __name__ == "__main__":

hey there! i found this on most of codes on net. i do not know what does it mean. i just know it's a top lvl script environment. any idea?

2nd Dec 2017, 1:18 PM
Aref moloughi
Aref moloughi - avatar
2 Respostas
+ 5
it's what runs when you call the script, as far as I know. I don't use it often (though maybe I should!)
2nd Dec 2017, 1:48 PM
Ahri Fox
Ahri Fox - avatar
+ 2
__main__ is usually what is run on code runners. __name__ can take on other names too
2nd Dec 2017, 1:56 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar