“Python jika Main” Kode Jawaban

Python jika 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__ dalam 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

Jawaban yang mirip dengan “Python jika Main”

Pertanyaan yang mirip dengan “Python jika Main”

Lebih banyak jawaban terkait untuk “Python jika Main” di Python

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya