1.题目描述
2022年1月1日至2022年1月2日相差一天,那么请问1949年10月1日到2022年1月1日相差了几天?
2.题目分析
python的内置函数真的很强大,直接上代码感受一下
import datetime
from datetime import date
a = datetime.datetime(1949,10,1)
b = datetime.datetime(2022,1,1)
c = (b-a).days
print(c)
3.运行结果
1.题目描述
2022年1月1日至2022年1月2日相差一天,那么请问1949年10月1日到2022年1月1日相差了几天?
2.题目分析
python的内置函数真的很强大,直接上代码感受一下
import datetime
from datetime import date
a = datetime.datetime(1949,10,1)
b = datetime.datetime(2022,1,1)
c = (b-a).days
print(c)
3.运行结果