|
|
发表于 2017-2-14 08:51:46
|
显示全部楼层
int(x, base=10)
Return an integer object constructed from a number or string x, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.
如果x是一个数字返回的是向下取整的整数
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in radix base.
如果x不是一个数字,或者如果给出了base,那么x是一个字符串,字节或bytearray实例,表示一个整数。
我的理解是:int()函数的参数不为数字时,它的参数必须是整数字符串(默认为十进制) |
|