표현식 : %[-][너비][.정밀도]c
(c는 위 그림의 포맷 문자 중 하나)

 

>>> print('The num : %d %d %d' % (10, 20, 30) )
	The num : 10 20 30
>>> 
>>> # print함수 없이도 가능
>>> 'String only %d' % 10
	String only 10
>>> 
>>> # *기호 
>>> '%0*d' % (3, 5)
>>> 005
>>> '%*.*f' % (8, 2, 3.141592)
	    3.14

'Python > 공통이론' 카테고리의 다른 글

Python - format 메서드  (0) 2023.04.14
Python - format 함수  (0) 2023.04.14
Python - 커맨드 라인 인수 접근하기  (0) 2023.04.13
Python - 이터레이터 & 제너레이터  (0) 2023.04.12
Python - 데코레이터  (0) 2023.04.12

+ Recent posts