# End 옵션 사용 print('welcome to', end=' ') print('the black parade', end=' ') print('piano notes') print('testtest')
1 2
welcome to the black parade piano notes testtest
format
format 옵션을 이용하여 다양하게 특정한 출력 값들을 매칭 시켜줄 수 있다.
1 2 3 4
# format 사용 [] , {}, () print('{} and {}'.format('You', 'me')) print('{0} and {1}, and {0}'.format('You', 'me')) print('{a} are {b}'.format(a='you', b='me'))
1 2 3
You and me You and me, and You you are me
%s : 문자, %d = 정수, %f = 실수
1 2 3 4 5 6
# %s : 문자, %d = 정수, %f = 실수 print("%s's favorite number is %d" %('Cluad', 3))