HTML 소스에서 태그와 개행문자 날리기

2022. 2. 3. 17:47파이썬/데이터 스크래핑

import re
pattern = '<[^>]*>'
text = df.text[0]
text = re.sub(pattern=pattern, repl='', string=text)
pattern = r"\r|\n|\xa0"
text = re.sub(pattern=pattern, repl='', string=text)
text = text.strip()

제곧내

반응형