Advertisement
Debug__

XML Parse in Python

Dec 2nd, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. from xml.etree  import ElementTree as xmlTree
  2. def xmlArray(xml):
  3.     try:
  4.         if xml.find('<', 1) >= 0:
  5.             raise Exception("Exception.")
  6.         resp = xmlTree.fromstring(xml)
  7.         return [resp.tag, resp.attrib]
  8.     except Exception, e:
  9.         return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement