print(" {0},{2},{1} 출력".format("0","2","1"))
// 0,1,2 출력 --> 출력 순서를 정할 수 있음
num1= 1
num2=3
print(" {0}/{1}={2}".format( num1 , num2 , num1 / num2 ))
// 1/3=0.333333333...
print(" {0}/{1}={2:.2f}".format( num1 , num2 , num1 / num2 ))
// 1/3=0.33
print(" {0}/{1}={2:.0f}".format( num1 , num2 , num1 / num2 ))
// 1/3=0
'program > python' 카테고리의 다른 글
[python] window 설치 (0) | 2024.01.28 |
---|---|
[python] type 함수 (0) | 2024.01.28 |
[python] 문자열 포맷팅 (1) | 2024.01.28 |
[python] 형변환 (0) | 2024.01.28 |
[python] 문자열 (0) | 2024.01.28 |