Python基础:int()函数

https://www.runoob.com/python/python-func-int.html

int() 方法的语法:

class int(x, base=10)
x -- 字符串或数字。
base -- 进制数,默认十进制。

错误示例

int("92",8)

异常类型:ValueError
异常原因:92不是一个八进制数(9超出范围)

posted @ 2022-05-19 19:16  孤舟浮岸  阅读(888)  评论(0编辑  收藏  举报