示例#1
0
def parseCities(data):
    '''
    This function will parse all the cities' information from provided Json file 
    And add parsed city information into city dictionary
    Also update continent dictionary
    '''
    for city in data["metros"]:
        portCity = CityInfo.CityInfo(city["code"], city["name"], city["country"], 
                                    city["continent"], city["timezone"], city["coordinates"], 
                                    city["population"], city["region"])
        QueryingData.cityDicationary[city["name"]] = portCity   #add city to city dictionary
        QueryingData.codeToName[city["code"]] = city["name"]
        UserQuerying.cityToContinent(city["name"], city["continent"])   #classic cities based on continent