Python's timedelta: can't I just get in whatever time unit I want the value of the entire difference?

后端 未结 4 464
眼角桃花
眼角桃花 2021-01-17 10:44

I am trying to have some clever dates since a post has been made on my site (\"seconds since, hours since, weeks since, etc..\") and I\'m using datetime.timedelta difference

4条回答
  •  萌比男神i
    2021-01-17 10:56

    It seems that Python 2.7 has introduced a total_seconds() method, which is what you were looking for, I believe!

提交回复
热议问题