if __name__ == “__main__” क्या करता है?
📁 सज्जाकार, विधि, बहुप्रक्रियण, पार्सिंग
कॉल के दौरान क्या होता है if __name__ == "__main__":?
# Threading Example
import time, thread
def MyFunction(string, sleeptime, lock, *args):
while 1:
lock.acquire()
time.sleep(sleeptime)
lock.release()
time.sleep(sleeptime)
if __name__ == "__main__":
lock = thread.allocate_lock()
thread.start_new_thread(MyFunction, ("Thread #: 1", 2, lock))
thread.start_new_thread(MyFunction,