Jun-07-2017, 05:46 AM
I never use urllib or parser(DOM/SAX) from stander library,
there are better solution that almost is a standard in the Python world.
Eg Requests , BeautifulSoup, lxml
Example:
there are better solution that almost is a standard in the Python world.
Eg Requests , BeautifulSoup, lxml
Example:
import requests from bs4 import BeautifulSoup url = 'https://www.sec.gov/Archives/edgar/data/77877/000007787714000013/pdce-20131231.xml' url_get = requests.get(url) soup = BeautifulSoup(url_get.content, 'lxml-xml') drill = soup.find('ExploratoryDrilling', attrs={'contextRef':"FD2013Q4YTD"}) print(drill.text) #--> 58988000