30
__name__ ==“__main__”인 경우 어떻게합니까?
На этот вопрос есть ответы на 스택 오버플로 на русском : Что делают 경우 __name__ == "__main__"? 다음 코드가 주어지면 무엇을 if __name__ == "__main__":합니까? # Threading example import time, thread def myfunction(string, sleeptime, lock, *args): while True: lock.acquire() time.sleep(sleeptime) lock.release() time.sleep(sleeptime) if __name__ == "__main__": lock = thread.allocate_lock() thread.start_new_thread(myfunction, …