dunder main in python

0 votes
What does "if __name__ = __main__" mean in Python?
Jun 21, 2018 in Python by nightshade
• 870 points

1 answer to this question.

0 votes
It is a check to see if the script in which this is present, is being executed as a program or if it being called from an external program. If it is being executed as a standalone program, the code within the if statement will be executed, or else it won't be.
answered Jun 21, 2018 by Hamartia's Mask
• 1,580 points

Related Questions In Python

0 votes
0 answers

main function is not working in python

import quandl as Quandl, math import numpy as ...READ MORE

Feb 18 in Python by Vasu
• 140 points
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,850 points
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,371 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
0 votes
1 answer

Increment operators in Python

Python has no unary operators. So use ...READ MORE

answered May 11, 2018 in Python by Hamartia's Mask
• 1,580 points
0 votes
2 answers

Do-while loop in Python

A more pythonic way would be this: ``` while ...READ MORE

answered Jul 5 in Python by Composer3