【发布时间】:2018-07-13 00:11:33
【问题描述】:
尝试使用漂亮的汤和正则表达式替换。 Soup 找到了我需要的内容,然后将其转换为字符串并使用正则表达式进行替换,但它不起作用。有没有使用美汤的查找和替换。
soup = BeautifulSoup(file_data, 'html.parser')
found_data = soup.find(class_='front_page_feature')
found_data = str(found_data)
print(re.sub(found_data, mysql_data,file_data,flags = re.DOTALL))
【问题讨论】:
标签: regex python-3.x beautifulsoup