{"id":207,"date":"2020-11-08T11:29:01","date_gmt":"2020-11-08T09:29:01","guid":{"rendered":"https:\/\/wiki.dreid.ch\/?p=207"},"modified":"2020-11-08T11:29:11","modified_gmt":"2020-11-08T09:29:11","slug":"python-parser","status":"publish","type":"post","link":"https:\/\/wiki.dreid.ch\/?p=207","title":{"rendered":"Python Parser"},"content":{"rendered":"<p>************py ************<br \/>\nimport xml.etree.ElementTree as ET<br \/>\ndata=&#8221;&#8217;<?xml version=\"1.0\" encoding=\"UTF-8\"?><br \/>\n<metadata><br \/>\n<food><br \/>\n    <item name=\"breakfast\">Idly<\/item>\n    <price>$2.5<\/price>\n    <description><br \/>\n   Two idly&#8217;s with chutney<br \/>\n   <\/description><br \/>\n    <calories>553<\/calories><br \/>\n<\/food><br \/>\n<\/metadata><br \/>\n&#8221;&#8217;<br \/>\nmyroot = ET.fromstring(data)<br \/>\n#print(myroot)<br \/>\nprint(myroot.tag)<\/p>\n<p>************xml************<br \/>\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><br \/>\n<metadata><br \/>\n<food><br \/>\n    <item name=\"breakfast\">Idly<\/item>\n    <price>$2.5<\/price>\n    <description><br \/>\n   Two idly&#8217;s with chutney<br \/>\n   <\/description><br \/>\n    <calories>553<\/calories><br \/>\n<\/food><br \/>\n<food><br \/>\n    <item name=\"breakfast\">Paper Dosa<\/item>\n    <price>$2.7<\/price>\n    <description><br \/>\n    Plain paper dosa with chutney<br \/>\n    <\/description><br \/>\n    <calories>700<\/calories><br \/>\n<\/food><br \/>\n<food><br \/>\n    <item name=\"breakfast\">Upma<\/item>\n    <price>$3.65<\/price>\n    <description><br \/>\n    Rava upma with bajji<br \/>\n    <\/description><br \/>\n    <calories>600<\/calories><br \/>\n<\/food><br \/>\n<food><br \/>\n    <item name=\"breakfast\">Bisi Bele Bath<\/item>\n    <price>$4.50<\/price>\n    <description><br \/>\n   Bisi Bele Bath with sev<br \/>\n    <\/description><br \/>\n    <calories>400<\/calories><br \/>\n<\/food><br \/>\n<food><br \/>\n    <item name=\"breakfast\">Kesari Bath<\/item>\n    <price>$1.95<\/price>\n    <description><br \/>\n    Sweet rava with saffron<br \/>\n    <\/description><br \/>\n    <calories>950<\/calories><br \/>\n<\/food><br \/>\n<\/metadata><\/p>\n","protected":false},"excerpt":{"rendered":"<p>************py ************ import xml.etree.ElementTree as ET data=&#8221;&#8217; Idly $2.5 Two idly&#8217;s with chutney [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=207"}],"version-history":[{"count":1,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=\/wp\/v2\/posts\/207\/revisions\/208"}],"wp:attachment":[{"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wiki.dreid.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}