展开全部
import datetime
year=int(raw_input('Year:'))
month=int(raw_input('Month:'))
day=int(raw_input('Day:'))
try:
aDate = datetime.datetime(year,month,day)
first = datetime.datetime(year,1,1)
print "Date is valid. It is ",(aDate-first).days," of the year"
except ValueError:
print "Date is invalid"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询