def load_city(self, filename): parser = ConfigParser.ConfigParser() parser.read(filename) city = City() for section in parser.sections(): if parser.get(section, 'type') == 'npc': city.add_npc(self._create_npc(section, parser)) elif parser.get(section, 'type') == 'stock': city.add_stock_market(self._create_stock(section, parser)) return city