728x90
1. 공백 삭제
text = "Hello World Bye"
print(text.replace(" ", ""))
# HelloWorldBye
2. 특정 문자로 변환
text = "a.monkeycow.tistory.com"
print(text.replace("a", "www"))
# www.monkeycow.tistory.com
'selenium > 문자열' 카테고리의 다른 글
[Python] 문자열 제거 (0) | 2022.09.17 |
---|---|
[Python] 문자열 줄바꿈 기준으로 자르기 (splitline) (0) | 2022.09.16 |
[Python] 문자열 자르기 (split) (0) | 2022.09.16 |