0
我有以下代碼:比較datetime.datetime到time.strptime
nowtime = datetime.datetime.now()
newTime = time.strptime(myTimestring, '%Y-%m-%d %H:%M:%S')
if(newTime > nowTime):
#do some stuff
當然,我比較失敗了類型錯誤,「不能datetime.datetime比較元組」。請注意,我使用的是沒有datetime.strptime()的較舊版本的Python。我如何才能比較這個工作?
你看http://stackoverflow.com/questions/ 1697815 /你怎麼做轉換一個python時間結構時間對象到一個日期時間對象? – milancurcic
請說明確切的(舊)python版本,以便我們可以瀏覽文檔並尋求適當的補救措施。 – vonPetrushev