int
int
功能
把值转换为整数。
语法
int(value)
参数
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| value | Any | 否 | 无 | 要转换的值。 |
返回值
| 类型 | 说明 |
|---|---|
| Int | 返回 i64 整数值。 |
示例
result = int('42') // 输出:42 print result
注意事项
- 浮点值会按 BT 宽松整数规则转换。
把值转换为整数。
int(value)
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|---|---|---|---|---|
| value | Any | 否 | 无 | 要转换的值。 |
| 类型 | 说明 |
|---|---|
| Int | 返回 i64 整数值。 |
result = int('42') // 输出:42 print result