Advertisement
Guest User

Untitled

a guest
May 31st, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. 1) https://www.hl7.org/fhir/valueset-account-status.html
  2. 2) https://www.hl7.org/fhir/valueset-activity-reason.html
  3. 3) https://www.hl7.org/fhir/valueset-age-units.html
  4.  
  5. import requests
  6. from bs4 import BeautifulSoup
  7.  
  8. urls = [
  9. 'https://www.hl7.org/fhir/valueset-activity-reason.html',
  10. 'https://www.hl7.org/fhir/valueset-age-units.html'
  11. ]
  12.  
  13. for url in urls:
  14. r = requests.get(url)
  15. soup = BeautifulSoup(r.content, 'lxml')
  16.  
  17. h2 = soup.find(lambda elm: elm.name == "h2" and "Content Logical Definition" in elm.text)
  18. table = None
  19. for sibling in h2.find_next_siblings():
  20. if sibling.name == "table":
  21. table = sibling
  22. break
  23. if sibling.name == "h2":
  24. break
  25. print(table)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement