This is my 19th day of #100Dayscode and #python. Today I continue to learn python access to web data. In that course I learned XML.XML stand for Extensible markup language. The primary purpose of XML is to help information system share structure data. It started as a specified subset of the standard generalized markup language and is design to be the relatively human language.
My code start with importing json. JSON represent data as a nested list and dictionary. And here is an object inside of data. In dictionary we have key value pair but in JSON these are called object.
import xml.etree.ElementTree as ET import json data = """<person> <name>chunk</name> <phone type = "int1"> +1 732 303 4456 </phone> <email hide = "yes"/> </person>""" tree = ET.fromstring(data) print('Name:',tree.find('name').text) print('Attr:',tree.find('email').get('hide'))