文章詳情頁
python - datetime時間輸出的問題
瀏覽:168日期:2022-07-24 10:37:19
問題描述
1在codecademy上學習PYTHON基礎知識 學到 datetime
運行了一下代碼:
from datetime import datetimenow=datetime.now()#print nowprint now.yearprint now.monthprint now.dayprint now.time"輸出的問題是: 年 月 日 都沒問題 就是 時間那里 不知道是啥意思。’’’2017515<built-in method time of datetime.datetime object at 0x7f7bd75f7f30>None
問題解答
回答1:from datetime import datetimenow=datetime.now()#print nowprint now.yearprint now.monthprint now.dayprint now.hourprint now.minuteprint now.secondprint now.microsecond
沒有time屬性
print now.date()print now.time()print now.timetuple()print now.ctime()回答2:
print now.tiem()
相關文章:
1. MySQL 使用 group by 之后然后 IFNULL(COUNT(*),0) 為什么還是會獲得 null2. wordpress里,這樣的目錄列表是屬于小工具還是啥?3. 一直報這個錯誤4. 常量在外面不加引號會報錯。5. python如何設置一個隨著系統(tǒng)時間變化的動態(tài)變量?6. mysql - 大部分數(shù)據(jù)沒有行溢出的text字段是否需要拆表7. mysql federated引擎無法開啟8. sublime text3安裝package control失敗9. 我的怎么不顯示啊,話說有沒有QQ群什么的10. mysql 為什么主鍵 id 和 pid 都市索引, id > 10 走索引 time > 10 不走索引?
排行榜

熱門標簽