if _name_ == "_main_': <do something> This code gives error massage NameError: name '_name_' is not defined Please help me with the right code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

if _name_ == "_main_': <do something> This code gives error massage NameError: name '_name_' is not defined Please help me with the right code

25th Dec 2016, 2:25 PM
Biswascoder
Biswascoder - avatar
5 Answers
+ 3
You must double the underscore character, like this if __name__ == "__main__": # instead _name_ and _main_
25th Dec 2016, 2:27 PM
visph
visph - avatar
+ 1
Not quotes ( I did'nt see ^^ ), but underscores ^^
25th Dec 2016, 2:29 PM
visph
visph - avatar
0
Sorry for the typo! I used double qutes
25th Dec 2016, 2:28 PM
Biswascoder
Biswascoder - avatar
0
Ok i got it thank u so much
25th Dec 2016, 2:30 PM
Biswascoder
Biswascoder - avatar
0
Great visph it was realy silly mistake. Tnx again
25th Dec 2016, 2:31 PM
Biswascoder
Biswascoder - avatar