Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. I have the below data which is stored in a string. It resembles xml. Is there a way that I can extract the contents of div class "page" and extract all the text under it?
  2.  
  3. Below is the content which is stored in a string variable:
  4.  
  5. import xml.etree.ElementTree as ET
  6. xml = ET.fromstring(str_content)
  7. for tree in xml:
  8. print(tree.text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement