본문 바로가기

Python

[Python] 문자(한글, 영문)와 숫자만 나기고 특수문자 제거하기

 

import re 
string = "abcdefㄱㄴㄷㄹㅁㅂ가나다라마바사12345[]{}().,!?'`~;:" 
re.sub('[^A-Za-z0-9가-힣]', '', string)
 
# Out: 'abcdef가나다라마바사12345'

 

출처: https://signing.tistory.com/74 [끄적거림]