Parsing Xml File And Extract In Python
I have this file:
Solution 1:
With BeautifulSoup this is trivial:
from bs4 import BeautifulSoup
soup = BeautifulSoup(yoursource)
for cite in soup.find_all('cite'):
print cite.string
For the given sample file that produces:
>>> import requests
>>> from bs4 import BeautifulSoup
>>> r = requests.get('https://raw.githubusercontent.com/MortezaLSC/Puplic/master/file.xml')
>>> soup = BeautifulSoup(r.content)
>>> for cite in soup.find_all('cite'):
... print cite.string
...
taksuncontrol.com
www.royal-jelve.ir
Post a Comment for "Parsing Xml File And Extract In Python"