Reputation: 3
I need to add a delay to part of a Python script, not the entire thing, but just a part.
Upvotes: 0
Views: 176
Reputation: 117681
You can use time.sleep
:
import time
time.sleep(1) # Sleeps for one second.
Note that generally you don't want a real delay, but you want one thing to happen before the other. Using a delay to emulate ordering is bad code, and will break.
Upvotes: 2