![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
内置函数
SzetoZeZe
I like poplar trees in the desert, because I should learn from him and firm their goals.
展开
-
Python内置函数详解之类型转换
# int:根据传入的参数创建一个新的整数 int() #不传入参数时,得到结果0 int(3) int(3.6) int("3") # float:根据传入的参数创建一个新的浮点数 float() # 不提供参数的时候,返回0.0 float(3) float('3') # complex:根据传入参数创建一个新的..原创 2021-12-09 16:41:08 · 352 阅读 · 0 评论 -
Python内置函数详解之数学运算
# 数学运算 # abs:求数值的绝对值 abs(-2) # 数学运算 # divmod:返回两个数值的商和余数 divmod(5, 2) divmod(5.5, 2) # max:返回可迭代对象中的元素中的最大值或者所有参数的最大值 max(1, 2, 3) # 传入3个参数 取3个中较大者 max('1234') # 传入1个可迭代对象,取其最大元素值 max(-1, 0) # 数值默认去数值较大者 max(-1, 0, key=abs) # 传入了求绝对值函数,则参数都会进..原创 2021-12-03 16:41:50 · 303 阅读 · 0 评论