Python if main == name || Special Variable || Python
In this we are going to see a basic program to check whether a program is called main program or not in Python Programming Language.



print(f"File1 __name__ = {__name__}")

if __name__ == "__main__":
    print("File1 is being run directly")
else:
    print("File1 is being imported")

# Coded By DHIRAJ SHELKE


#ENJOY CODING


Post a Comment

FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP

Previous Post Next Post