Warning: count(): Parameter must be an array or an object that implements Countable in /home/luiscoms/www/blog/wp-includes/post-template.php on line 293

Warning: count(): Parameter must be an array or an object that implements Countable in /home/luiscoms/www/blog/wp-includes/post-template.php on line 293

Warning: count(): Parameter must be an array or an object that implements Countable in /home/luiscoms/www/blog/wp-includes/post-template.php on line 293

Warning: count(): Parameter must be an array or an object that implements Countable in /home/luiscoms/www/blog/wp-includes/post-template.php on line 293

Warning: count(): Parameter must be an array or an object that implements Countable in /home/luiscoms/www/blog/wp-includes/post-template.php on line 293
Sep
22
2014

Convert python dictionary to xml

Recently, I needed to create a Python service that returns JSON and XML.

There is a struct in Python called dictionary (dict) that is next to JSON and already have a specific class to convert it. So, I created a dictionary structure and was already halfway there.

For XML there are another classes, but I would needed to implement the same logic again and it is a bad smell.

Searching, I found some gists of functions that convert dict to XML but they were not what I needed.

So follow the complete code that I used to create based on another gists.

References:

And you, already had similar situation? Comment it!

Written by Luis com S in: Python | Tags: , , ,

Deixe um Comentário

Loading Disqus Comments ...
Loading Facebook Comments ...

No Comments »

RSS feed for comments on this post.


Leave a Reply


Time limit is exhausted. Please reload CAPTCHA.

Design: TheBuckmaker.com Web Templates