python 如何計算時間差

Python Tip]如何計算時間差html Q:如何方便的計算兩個時間的差,如兩個時間相差幾天,幾小時等python A:使用datetime模塊能夠很方便的解決這個問題,舉例以下:post >>> import datetime >>> d1 = datetime.datetime(2005, 2, 16) >>> d2 = datetime.datetime(2004, 12, 31) >>
相關文章
相關標籤/搜索