How to get the current time in Python

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

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

30条回答
  •  青春惊慌失措
    2020-11-22 07:31

    >>> import datetime, time
    >>> time = time.strftime("%H:%M:%S:%MS", time.localtime())
    >>> print time
    '00:21:38:20S'
    

提交回复
热议问题