“Python wenn Main” Code-Antworten

Python wenn Main

# if __name__ == '__main__' checks if a file is imported as a module or not.
# example: 
def main():
    print('Hello World')
    
if __name__ == '__main__':
    # This code won't run if this file is imported.
    main()
Djebbes Rabah

__name __ == __main__ in Python

# If the python interpreter is running that module (the source file)
# as the main program, it sets the special __name__ variable to have
# a value “__main__”. If this file is being imported from another 
# module, __name__ will be set to the module’s name.
if __name__=='__main__':
  # do something
Noobie Nareshhhh

Ähnliche Antworten wie “Python wenn Main”

Fragen ähnlich wie “Python wenn Main”

Weitere verwandte Antworten zu “Python wenn Main” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen