Skip to main content

Convert python dictionary into a xml equivalent format

Project description

Convert python dictionary into a xml equivalent output

Usage of Pydicttoxml

d = {
  'student': {
      'name': 'Shera',
      'age': 25,
      'address': {
          'pin': 500082,
          'city': 'Hyderabad',
          'state': 'telangana',
          'country': 'India'
      }
   }
}

from pydicttoxml import dict2xml
xml = dict2xml(d, root_tag_name="data")

Output

<?xml version="1.0" encoding="UTF-8"?>
<data>
  <student>
    <name>Shera</name>
    <age>25</age>
    <address>
      <pin>500082</pin>
      <city>Hyderabad</city>
      <state>telangana</state>
      <country>India</country>
    </address>
  </student>
</data>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydicttoxml-1.0.1.tar.gz (2.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page