发布于 1年前

Python 如何求商和余数

quotient, remainder = divmod(4, 5)

print(quotient, remainder)
# 0 4

divmod()函数返回当参数1除以参数2时,包含商和余数的元组。

©2020 edoou.com   京ICP备16001874号-3