+ 1

what is __name__ in Python

16th Jan 2017, 5:52 AM
Gopikrishna A
Gopikrishna A - avatar
1 Réponse
+ 2
Before programs are executed, special variables are defined. Take into account, you're running your program from a source file and that source file is like your main program. A special variable that's called __name__ will have the value of '__main__'. If you're importing the module to like another module __name__ will have the value of the module's name instead of '__main__'. All in all, it's not too hard of a concept. If you're confused I would strongly recommend for you to search it up. You might learn something new
17th Jan 2017, 3:46 AM
Don
Don - avatar