Guest User

Untitled

a guest
Mar 23rd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. from string import Template
  2.  
  3. XML_TEMPLATE = Template("""
  4. <xml>
  5. <name>$name</name>
  6. <place>
  7. <city>$city</city>
  8. <country>$country</country>
  9. </place>
  10. <lang code="$code" />
  11. </xml>
  12. """)
  13.  
  14. params = {
  15. 'name':'John Smith',
  16. 'city':'Mumbai',
  17. 'country':'India',
  18. 'code':'Marathi'
  19. }
  20.  
  21. print(XML_TEMPLATE.substitute(params))
Add Comment
Please, Sign In to add comment