Coding/Python

[python]문자열 replace

후__아 2024. 4. 16. 14:29

※ 문자열.replace('a', 'b')

문자열에서 '모든' a를 b로 교체

=> replace('a', 'b', n): n번만 교체

#프로그래머스 두 문자열 붙이기
str1, str2 = input().strip().split(' ')
print(str1 + str2)

# replace 활용
print(input().strip().replace(' ', '')