본문 바로가기
Python/Python

re 모듈 - 문자열에서 숫자만 제거하기

by Sondho 2020. 4. 28.
import re

문자열 = "1q2w3e4r"
p = re.compile("[^0-9]")
print("".join(p.findall(문자열)))


# 실행결과
qwer

댓글