문자열
포맷팅
print('My name is %s' % '최') # My name is 최
print('x = %d, y = %d' % (3, 2)) # x = 3, y = 2
print('%d x %d = %d' % (4, 5, 4+5)) # 2 x 3 = 6포맷 함수.
print('My name is %s' % '최') # My name is 최
print('My name is {}'.format('최')) # My name is 최
print('{} x {} ={}'.format(5, 4, 5 * 4)) # 5 x 4 = 20
print('{1} x {0} ={2}'.format(1, 2, 1 * 2)) # 괄호 안의 숫자는 순서를 지정 2 x 1 = 2인덱싱
슬라이싱
메서드
end
Last updated