인프런 커뮤니티 질문&답변
%s에 정수를 넣어봤는데도 작동해요
작성
·
262
0
print('%s %s' % ('one', 'two'))에 one, two 대신 1, 2를 넣어도 출력이 가능하던데 그럼에도 format을 출력하는 이유가 있을까요?
#format 사용 (d: 정수, s:문자열, f:실수)
print('%s %s' % ('one', 'two')) #정석적
print('{} {}'.format('one', 'two')) #format 함수가 내부적으로 처리해줌




