在 Python 中,可以使用内置函数 int() 将浮点型数据转换为整型。例如: a = 3.14 b = int(a) print(b) 输出结果为: 3 注意,转换为整型时,会将浮点数四舍五入到最接近的整数。