float에서 숫자를 제거하는 방법
def truncate(f, n): """Truncates/pads a float f to n decimal places without rounding""" s = '{}'.format(f) if 'e' in s or 'E' in s: return '{0:.{1}f}'.format(f, n) i, p, d = s.partition('.') return '.'.join([i, (d '0'*n)[:n]])
def truncate(f, n): """Truncates/pads a float f to n decimal places without rounding""" s = '{}'.format(f) if 'e' in s or 'E' in s: return '{0:.{1}f}'.format(f, n) i, p, d = s.partition('.') return '.'.join([i, (d '0'*n)[:n]])
에서 숫자를 제거하고 소수점 후 특정 숫자를 유지하십시오. 다음 단계 :
부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.
Copyright© 2022 湘ICP备2022001581号-3