-2
比方說,我拉使用此命令文件的日期:如何比較不同格式的時間/日期?
>> date_created = time.ctime(os.path.getctime(latest_file))
>> print (date_created)
Thu Aug 17 13:44:19 2017
我怎麼能說這個日期比作今天或明天的例子嗎?我怎樣才能拔出專門8月17日說:
僞代碼:
if (Aug 17 = today){
function()
}
else{
break
}
從本質上講,我希望能有今天的檢查文件是否被創建,如果它當時執行的功能。
比方說,我拉當前日期格式如下:
date_time = time.strftime('%m-%d-%Y')
不要比較*字符串*。比較日期對象。 –