파이썬(Python) 소수점 자리수 처리 - format
3월 04, 2023
In Python |
파이썬(Python) 소수점 자리수 처리 - format
소수점 자리수 처리
아래 예제는 소수점 둘째 자리까지만 표시합니다.
test = 12345.123456
a = "{0:0.2f}".format(test)
print(a)
>> 12345.12
정수 자리수 처리
test = 12345.123456
a = "{0:10.2f}".format(test)
print(a)
>> 12345.12