Python/Python__works

python으로 데이터 정리하기

말하는감자 2019. 9. 23. 16:25
import re

#특수문자 제거
data = re.sub('[-_=+,#/\?:^$.@*\"※~&%ㆍ!』\\‘|\(\)\[\]\<\>`\'…》]', '', string_data)

#공백 전체 제거
data = string_data.strip()

#strip으로 가끔 안지워질때 제거 방법 ㅠㅠ
data = re.compile(r'\s+', '', string_data)

#원시적인 방법 ㅠㅠ
data = string_data.replace(' ', '')

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

lambda  (0) 2019.10.17
문자열 치환하기  (0) 2019.10.11
python response xml self-end tag issue  (0) 2019.09.20
python으로 xml을 만들어요  (0) 2019.09.20
xml 파일 열어서 dict 변환후에 데이터 만져주기~  (0) 2019.09.20