15.print Format
by SANGGI JEON
print 출력 방법
print(1, 2, 3)
print("%d %d %d" %(1, 2, 3))
print("%f %.1f %.2f" %(1.1, 2.2, 3.2))
print("%s--%s--%s" %('abc', 'def', 'ghi'))
print("{} {} {}".format('abc', 'def', 'ghi'))
print("{1}, {0}, {2}".format('abc', 'def', 'ghi'))
print(f"{'def'}{'abc'}{'ghi'}")
print("{0:>10s}".format('python'))
print("{0:<10s}".format('python'))
print(f"{'python':>10s}")
print(f"{'python':<10s}")
# 결과 값
1 2 3
1 2 3
1.100000 2.2 3.20
abc--def--ghi
abc def ghi
def, abc, ghi
defabcghi
python
python
python
python
Subscribe via RSS