import time, threading
def fun():
for i in range(5):
time.sleep(1)
print(i)
def main():
thread = threading.Thread(target=fun)
thread.start()
thread.join()
# A thread foi finalizada, fazer algo a partir daqui
print("Thread finalizada")
main()
aW1wb3J0IHRpbWUsIHRocmVhZGluZwoKZGVmIGZ1bigpOgogICAgZm9yIGkgaW4gcmFuZ2UoNSk6CiAgICAgICAgdGltZS5zbGVlcCgxKQogICAgICAgIHByaW50KGkpCgpkZWYgbWFpbigpOgogICAgdGhyZWFkID0gdGhyZWFkaW5nLlRocmVhZCh0YXJnZXQ9ZnVuKQogICAgdGhyZWFkLnN0YXJ0KCkKICAgIHRocmVhZC5qb2luKCkKICAgICMgQSB0aHJlYWQgZm9pIGZpbmFsaXphZGEsIGZhemVyIGFsZ28gYSBwYXJ0aXIgZGFxdWkKICAgIHByaW50KCJUaHJlYWQgZmluYWxpemFkYSIpCgptYWluKCk=