“Python attendez” Réponses codées

Python attendez 1 sec

import time
 
# Wait for 5 seconds
time.sleep(5)
 
# Wait for 300 milliseconds
# .3 can also be used
time.sleep(.300)
Blushing Bat

retard de temps python

import time
while True:
    print("This prints once a minute.")
    time.sleep(60) # Delay for 1 minute (60 seconds).
Dangerous Dugong

attendre la fonction Python

import time
#Waits 1 second
time.sleep(1)
DatMADCoder

Python attendez jusqu'à

import time
def waitUntil(condition, output): #defines function
    wU = True
    while wU == True:
        if condition: #checks the condition
            output
            wU = False
        time.sleep(60) #waits 60s for preformance

waitUntil(Cookies >= 0, eatCookies()) #runs function (output MUST be another function)
Whoop de Doop

code python à attendre

# You need to import time first
import time
#now you have time you can make time wait/sleep
time.sleep(10)
#time will wait/sleep for 10 seconds
Testy Tapir

Python attendez

import time

def wait_until(somepredicate, timeout, period=0.25, *args, **kwargs):
  mustend = time.time() + timeout
  while time.time() < mustend:
    if somepredicate(*args, **kwargs): return True
    time.sleep(period)
  return False
Bewildered Beaver

Réponses similaires à “Python attendez”

Questions similaires à “Python attendez”

Plus de réponses similaires à “Python attendez” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code