While everyone else has suggested the de facto time
module, I thought I'd share a different method using matplotlib
's pyplot
function, pause
.
from matplotlib import pyplot as plt
plt.pause(5) # Pauses the program for 5 seconds
Typically this is used to prevent the plot from disappearing as soon as it is plotted or to make crude animations.
This would save you an import
if you already have matplotlib
imported.