[date] python 날짜 계산(d-day 계산)

Liberay

from datetime import date

date.days : return day (int)

Code

from datetime import date

end_date = input().split()
start_date = input().split()

end = date(int(end_date[2]), int(end_date[1]), int(end_date[0]))
start = date(int(start_date[2]), int(start_date[1]), int(start_date[0]))
resl = (end - start).days 

Ex)

input : 1 23 2018
              1 20 2018 

output : 3

글의 문제가 있다면 댓글을 달아 주세요.

This site uses Akismet to reduce spam. Learn how your comment data is processed.