python 小数转字符串保留几个小数

def floattostr(x,xsnum):
    return str(round(x,xsnum))
#xsnum是小数位数,x是小数
原文地址:https://www.cnblogs.com/gisoracle/p/14410947.html