t = e['updated_parsed']
dt = datetime.datetime(t[0],t[1],t[2],t[3],t[4],t[5],t[6]
print dt
>>>2010-01-28 08:39:49.000003
Run Code Online (Sandbox Code Playgroud)
如何将其转换为字符串?:
"January 28, 2010"
Run Code Online (Sandbox Code Playgroud) 我正在练习Python,我想编写一个程序来检查当前时间,看看它是否与下午2:12匹配并说:its lunch time
所以首先我想出了使用import time
模块,但我不知道如何?
我的问题是我不知道如何使用时间模块.或者我使用正确的语法?
我的代码:
import time
bake=time()
if bake == '2:12':
print ('its time to eating lunch')
else :
print ('its not the time for eating lunch')
Run Code Online (Sandbox Code Playgroud)