return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object
2020. 7. 1. 21:51ㆍpython
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
re.sub 사용시 에러
어쩌구 저쩌구
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
나온다... 치환을 하고 싶어서 사용한 re.sub()가 구글링에선 많이 보이는데 오류가 난다?
tag = re.sub('<.+?>', '', tag)
(태그를 제거 하고 싶었다)
말고
tag = re.sub('<.+?>', '', '{}'.format(tag))
잘 알고 있는 format을 써보자..
'python' 카테고리의 다른 글
[python] pymysql 설치, python mysql 연결 (0) | 2024.02.13 |
---|---|
[python, selenium, centos] 캡쳐 한글깨짐 처리 (0) | 2021.12.27 |
[python] pyinstaller chromedriver 콘솔창 제거 (0) | 2021.08.02 |
[pyinstaller] 이미지 추가 (0) | 2021.06.09 |
[python] 파이썬 설치 (0) | 2020.03.26 |