+ 1

Why added to python program file ?

If_name_ ==“_main_”: main()

2nd Jan 2021, 4:02 PM
Rocky Khatete Tonny
Rocky Khatete Tonny - avatar
2 Antworten
+ 3
See this answer and btw it is double underscore if __name__ == "__main__" : https://www.sololearn.com/Discuss/2296422/?ref=app
2nd Jan 2021, 4:12 PM
noteve
noteve - avatar
+ 3
The __name__ variable is a special Python variable. It gets its value depending on how we execute the containing script. If we execute the original script it's value will be main but if we use this script from any other script it's value will be same as your original script's name
2nd Jan 2021, 4:12 PM
Deekshant
Deekshant - avatar