学习内容:
数字日期,random,timedelta的常见操作
Tips:
1.数字的输出方式
1)“{ : , .2 f }”.format(a)
意思是,我们输出a,并且每3位用逗号隔开,保留小数点后2位,浮点型输出
2)f“{a}”表示输出a,在{}内也可以进行1)所用到的功能
3)math包
math.trunc()截断取整
math.floor()向下取整
math.cell()向上取整
4)全局操作
四舍五入 round(a,2)输出a,保留2位小数
2.random
操作
python DAY_8(2)数字日期,random,timedelta的常见操作
具体代码如下,过多不再赘述
python DAY_8(2)数字日期,random,timedelta的常见操作
python DAY_8(2)数字日期,random,timedelta的常见操作

3.日期与时间的操作
python DAY_8(2)数字日期,random,timedelta的常见操作

具体操作如下,因为比较容易,直接参考别人的代码

python DAY_8(2)数字日期,random,timedelta的常见操作
python DAY_8(2)数字日期,random,timedelta的常见操作
python DAY_8(2)数字日期,random,timedelta的常见操作

python DAY_8(2)数字日期,random,timedelta的常见操作

4.timedelta的常见操作
python DAY_8(2)数字日期,random,timedelta的常见操作
python DAY_8(2)数字日期,random,timedelta的常见操作

具体功能和方法可查阅资料,上述功能,在简单的操作之后便能理解,掌握还需要一定的练习。

相关文章:

  • 2021-10-12
  • 2022-01-12
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2022-02-19
猜你喜欢
  • 2022-01-24
  • 2021-05-28
  • 2021-12-15
  • 2021-04-22
  • 2021-08-18
  • 2022-02-07
相关资源
相似解决方案