当python需要对包含小数点的数值进行int转型的时候,要用到int(round(float(变量名或者字符串数值))
我原来的变量,countcatlevel数值为2.0
countnum = string._int(line[5])
修改为:
countnum = int(round(float(line[5])))解决问题!
当python需要对包含小数点的数值进行int转型的时候,要用到int(round(float(变量名或者字符串数值))
我原来的变量,countcatlevel数值为2.0
countnum = string._int(line[5])
修改为:
countnum = int(round(float(line[5])))解决问题!