Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. context = iterparse(source, events=("start", "end"))
  2.  
  3. # turn it into an iterator
  4. context = iter(context)
  5.  
  6. # get the root element
  7. event, root = context.next()
  8.  
  9. for event, elem in context:
  10.     if event == "end" and elem.tag == "items":
  11.         #dein code
  12.         root.clear()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement