“Python Time Library” Réponses codées

horloge python

# Here is a self updating clock function, just run it and it'll self update itself until you hit CTRL-C
import datetime
import time
def clock():
    while True:
        print(datetime.datetime.now().strftime("%H:%M:%S"), end="\r")
        time.sleep(1)

clock()
Random boi

Python Time Library

#also see datetime
import time
now = time.time()
print(now)
Dr. Hippo

temps python

#!/usr/bin/python
import time

t = (2009, 2, 17, 17, 3, 38, 1, 48, 0)
t = time.mktime(t)
print time.strftime("%b %d %Y %H:%M:%S", time.gmtime(t))
Crowded Crab

temps python

#!/usr/bin/python
import time

t = (2009, 2, 17, 17, 3, 38, 1, 48, 0)
t = time.mktime(t)
print time.strftime("%b %d %Y %H:%M:%S", time.gmtime(t))

OUTPUT:Feb 18 2009 00:03:38
Nilendu Ganguli

Réponses similaires à “Python Time Library”

Questions similaires à “Python Time Library”

Plus de réponses similaires à “Python Time Library” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code