一、数学计算模块
![请添加图片描述](https://i-blog.csdnimg.cn/blog_migrate/d9541ff9912625fd1d0d53150c28be76.png)
>>> import math
>>>math.cell(2.4)
3
>>> math.floor(2.4)
2
>>>math.ceil(2.4)
3
>>>math.ceil(-2.4)
-2
>>>math.floor(-2.4)
-3
>>>math.pow(5,3)
125.0
>>>math.sqrt(3.6)
1.8973665961010275
>>>math.log(125,5)
3.00000000000000004
>>>math.degrees(0.5 * math.pi)
90.0
二、日期时间模块
1.常用
- datetime:包含时间和日期。
- date:只包含日期。
- time:只包含时间。
- timedelta:计算时间跨度。
- tzinfo:时区信息。
2.datetime类
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/493e92d49b5d39c9d19df3fa4b077b3a.png)
>>>import datetime
>>>d = datetiem.datetime(2020, 2, 30)
Traceback(most recent call last):
File "<pyshell#22>", lin 1, in <module>
d = datetime.datetime(2020, 2, 30)
ValueError: day is out of range for month
>>>d = datetime.datetime(2020, 1, 29)
>>>d
datetime.datetime(2020, 1, 29, 0, 0)
>>>d = datetime.datetiem(2020, 1, 29, 23, 60, 59, 10000)
Traceback(most recent call last):
File "<pyshell#25>",line 1,in <module>
d = datetime.datetime(2020, 1, 29, 23, 60