处理小数
# coding=utf-8
# Time : 2021-08-01
# Author : wangkaiyu
# 保留一位小数
def deal_with_float(num, n):
num = str(num)
a, b, c = num.partition(".")
c = c[:n]
return float(".".join([a, c]))
# 去除小数点
def del_point(num):
num = str(num)
a, b, c = num.partition(".")
return int(a)