2024-06-16 11:41:05 发布
网友
我有一个html标签,如下所示
<a href="http://cwe.mitre.org/data/definitions/134.html">CWE-134</a>
我想把那部分留在里面
请提出这样做的任何步骤
for _ in soup.find_all('a'): print _ text = re.split(r'">',re.split(r'="', str(_))[-1])[0] print text
摘录:
a_tag['href']
保存到文件:
with open('output.txt', 'w') as f: f.write(a_tag['href'])
将其写入文件,如TXT或CSV。或者将其存储到数据库中
摘录:
保存到文件:
将其写入文件,如TXT或CSV。或者将其存储到数据库中
相关问题 更多 >
编程相关推荐