Answers for "sleep is not defined python"

23

python time delay

import time
while True:
    print("This prints once a minute.")
    time.sleep(60) # Delay for 1 minute (60 seconds).
Posted by: Guest on March-15-2020
7

how to use python to sleep if the user is not using the system

import time
print("This is how to pause a program")
time.sleep(5)
print("Did you saw that i slept for 5 seconds")
Posted by: Guest on July-27-2021
19

python delay

>>> import time
>>> time.sleep(3) # Sleep for 3 seconds
Posted by: Guest on May-11-2020
2

how to use python to sleep if the user is not using the system

import time
import requests
from pprint import pprint

try:
    
    Api_key = "Your api key"
    city_or_country = str(input('Write a "city" or "Country" name for which you want the weather:- '))
    print("Fetching Data of",city_or_country)
    time.sleep(4)
    URL = "https://api.openweathermap.org./data/2.5/weather?appid=" + Api_key + "&q="+ city_or_country
    weather_data = requests.get(URL).json()
    pprint(weather_data)
except ValueError:
    print("incorrect input or API KEY")
Posted by: Guest on June-25-2021
4

making a function wait in python

from time import sleep

>>> sleep(4)
Posted by: Guest on September-23-2020
3

wait in python

#Wait in python
#Module required - time
import time
#Wait in for the time you put
time.sleep(0.5)
print('Wait in python')
Posted by: Guest on October-04-2020

Python Answers by Framework

Browse Popular Code Answers by Language