Dlare
Dlare

Reputation: 3

How to add a delay to part of a script in Python?

I need to add a delay to part of a Python script, not the entire thing, but just a part.

Upvotes: 0

Views: 176

Answers (1)

orlp
orlp

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

Related Questions