Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from collections import OrderedDict
  2. import pickle
  3. import xml.etree.ElementTree as et
  4.  
  5. """
  6. returns location mapping => { id : name }
  7. """
  8. def location_mapping(self):
  9. #parse the xml file of the locations
  10. tree = et.parse(constants.DEVSET_TOPICS_DIR_PATH)
  11. #get the root tag of the xml file
  12. doc = tree.getroot()
  13. mapping = OrderedDict({})
  14. #map the location id(number) with the location name
  15. for topic in doc:
  16. mapping[topic.find("number").text] = topic.find("title").text
  17. return mapping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement