How to get the current time in Python

前端 未结 30 1431
滥情空心
滥情空心 2020-11-22 06:47

What is the module/method used to get the current time?

30条回答
  •  -上瘾入骨i
    2020-11-22 07:34

    You can do so using ctime():

    from time import time, ctime
    t = time()
    ctime(t)
    

    output:

    Sat Sep 14 21:27:08 2019

    These outputs are different because the timestamp returned by ctime() depends on your geographical location.

提交回复
热议问题