Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import OrderedDict
- import pickle
- import xml.etree.ElementTree as et
- """
- returns location mapping => { id : name }
- """
- def location_mapping(self):
- #parse the xml file of the locations
- tree = et.parse(constants.DEVSET_TOPICS_DIR_PATH)
- #get the root tag of the xml file
- doc = tree.getroot()
- mapping = OrderedDict({})
- #map the location id(number) with the location name
- for topic in doc:
- mapping[topic.find("number").text] = topic.find("title").text
- return mapping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement