본문 바로가기
IT/Python

python re sub remove special characters

by Jang HyunWoong 2022. 11. 17.
# remove special characters
corpus = "learning% makes 'me' happy. i am happy be-cause i am learning! :)"
corpus = re.sub(r"[^a-zA-Z0-9.?! ]+", "", corpus)
print(corpus)
learning makes me happy. i am happy because i am learning! 

 

반응형

'IT > Python' 카테고리의 다른 글

pynecone get started - pc run error  (0) 2023.01.16
aws s3 upload image using boto3, 이미지 올리기  (0) 2019.04.20
dataframe, head(), show all columns  (0) 2019.04.18
tensorflow Keras - not_equal, cast Test  (0) 2019.03.13
keras Masking Test  (0) 2019.03.13