Python 3.4 - Time Module

Time module has attributes that deal with time. You can have a program print out the time in different ways and you can use those variables as any others. One cool attribute is to have you program actually stop for a short or long amount of time.

See the example and video below:

import time


start = time.time()
(time.time())
print(time.asctime())
print(time.gmtime())
now = time.gmtime()
print(now[1])
now = time.asctime(now)
print(now)
time.sleep(3)
stop = time.time()
print(stop - start)

Tue May  8 13:11:25 2018
time.struct_time(tm_year=2018, tm_mon=5, tm_mday=8, tm_hour=20, tm_min=11, tm_sec=25, tm_wday=1, tm_yday=128, tm_isdst=0)
5
Tue May  8 20:11:25 2018
3.0046298503875732

Process finished with exit code 0

https://www.youtube.com/watch?v=Q9qp4CVngKE

Comments

Popular posts from this blog

Pyhton 3.4 - Continue

Conversations Ongoing: Valuing Modernization in Early European History

Conversations Ongoing: A Bunch of Amateurs