Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import threading
- import time
- import sys
- #not sure if you actually need this, but oh well
- print_lock = threading.Lock()
- def print_stuff():
- for _ in range(5):
- time.sleep(1)
- with print_lock:
- print("Hello" + " "*20) #put some spaces at the end to make sure the progress message is overwritten
- threading.Thread(target=print_stuff).start()
- for i in range(101):
- with print_lock:
- print(f"{i}% complete.\r", end="")
- time.sleep(0.033)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement