저는이 문제를 한동안 해결하려고 노력했지만이 작업을 수행하는 유일한 방법은 복잡한 while 루프를 사용하는 것입니다.BeautifulSoup4 (python 3.4)를 사용하여 모든 HTML 태그 제거
"<td colspan='2' class='ToEx'>This is a test (<i> to see </i> this works) and I really hope it does</td>"
및 출력이 :
나는 다음과 같은 입력하려는 본질적으로
"This is a test (to see if this works) and I really hope it does"
, 나는 에 "<>"와 모든과 어떤 사이 인을 제거 할 수 있습니다.
"This is a test (<i> to see </i> this works) and I really hope it does"
그러나 나는이 짜증나는 사람들과 함께 왼쪽 해요 : : 나는 몇 가지 명령을 할 수있는 최선은
from bs4 import BeautifulSoup
text = "<td colspan='2' class='ToEx'>This is a test (<i> to see </i> this works) and I really hope it does</td>"
soup = BeautifulSoup(text)
content = soup.find_all("td","ToEx")
content[0].renderContents()
먼저 시도했는데 오류가 발생하여 다른 작업이 진행되고있는 것 같습니다. 좀 더 고마워 할께 고마워. – RRR
@ user3757519 이걸 실행할 때 무슨 오류가 있니? –