코딩 오류

[Python] expected string or bytes-like object, got 'NoneType' 오류

ramin0119 2025. 4. 12. 22:47
728x90
clean_content = re.sub(r'<.*?>', '', content)

 

위와 같은 코드를 사용했는데, 

expected string or bytes-like object, got 'NoneType'와 같은 오류가 발생하였다.

 

clean_content = re.sub(r'<.*?>', '', str(content))

다음과 같이 re.sub 함수에 들어가는 인수를 str() 처리해준다면, 해결된다.

728x90