👨🏼‍💻개발/파이썬

파이썬 - 여러개의 문자열 변경하기

Janger 2021. 12. 8. 10:31
728x90
import re

txt = "Hi, my phone number is 089992654231. I am 34 years old. I live in 221B Baker Street. I have 1,000,000 in my bank account."

def processString3(txt):
  txt = re.sub('[0-9]', 'X', txt)
  print(txt)
  
processString3(txt)

 

출처: 

https://www.delftstack.com/ko/howto/python/python-replace-multiple-characters/

 

Python에서 문자열의 여러 문자를 바꾸는 방법

이 기사는 Python에서 문자열의 여러 문자를 바꾸는 방법을 보여줍니다.

www.delftstack.com

 

728x90