python浮点数转换整数
To input any value, we use input() function – which is an inbuilt function.
要输入任何值,我们使用input()函数-这是一个内置函数。
输入转换为整数 (Typecasting input to integer)
Syntax:
句法:
int(input())
Example:
例:
# input a number
num = int(input("Input a value: "))
# printing input value
print "num = ", num
Output
输出量
Input a value: 10
num = 10
类型转换输入浮动 (Typecasting Input to float)
Syntax:
句法:
float(input())
Example:
例:
# input a number
num = float(input("Input a value: "))
# printing input value
print "num = ", num
Output
输出量
Input a value: 10.23
num = 10.23
翻译自: https://www.includehelp.com/python/typecasting-input-to-integer-float.aspx
python浮点数转换整数