Help us understand the problem. What is going on with this article?

pythonで日時の差分を秒単位で出す方法

More than 5 years have passed since last update.

毎回ぐぐってるから書く。

import datetime

#year,month,day,hour,minute,second(,micro?)がdatetimeメソッドの引数
first_time = datetime.datetime(2013,11,10,11,11,11)
last_time =  datetime.datetime(2014,11,10,11,11,11)
delta = last_time - first_time
print delta.total_seconds()
#=>31536000.0 total_secondsを使って差を秒で表現
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away