Wikipedia转储xml文件在python中转换为文本
如何将wikimeadia转储xml文件转换为python中的文本。python中有任何包吗?不确定您有什么转储文件,您试图从文章中转换web内容,读取元素,并使用python写入文件 使用请求和bs4对象更好地使用网站刮取:Wikipedia转储xml文件在python中转换为文本,python,Python,如何将wikimeadia转储xml文件转换为python中的文本。python中有任何包吗?不确定您有什么转储文件,您试图从文章中转换web内容,读取元素,并使用python写入文件 使用请求和bs4对象更好地使用网站刮取: #Getting data from website - scrape import requests, bs4 #Getting HTML from the wikipedia page url = "https://en.wikipedia.org/wiki/Ei
#Getting data from website - scrape
import requests, bs4
#Getting HTML from the wikipedia page
url = "https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors"
req = requests.get(url)
#Create a bs4 object
soup = bs4.BeautifulSoup(req.text, "html5lib")
element = soup.select('.mwe-math-element')
print(element)
#You can save the required content to a file by manipulating the content in element list
我从链接中找到了XML文件: