
[英]How can I Extract Specific xml tags from a local xml file using python?
[英]How can I print specific tags from a html file with Python? [duplicate]
使用beautifulsoup
库。
from bs4 import BeautifulSoup
with open('text.html') as input_file:
soup = BeautifulSoup(input_file)
a_links = soup.find_all('a')
for link in a_links:
print link
使用re或Beautiful Soup 。 这两种方法中的任何一种都应能够帮助您满足您的需要,这取决于您是否实际要包含标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.