Skip to content

RONALD55/ZimPlaces-Python-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zim-Places

image

image

Features

  • This is a python package that allows you to search for cities, provinces, and districts in Zimbabwe.Zimbabwe is split into eight provinces and two cities that are designated as provincial capitals. Districts are organized into 59 provinces.Wards are organized into 1,200 districts.Visit the project homepage for further information on how to use the package.

Installation

To can install the zim_places open shell or terminal and run:

pip install zim-places

Usage

Get all wards:

from zim_places import wards
print(wards.get_wards())

Get all districts:

from zim_places import districts
print(districts.get_districts())

Get all cities:

from zim_places import cities
print(cities.get_cities())

Get all provinces:

from zim_places import provinces
print(provinces.get_provinces())
from zim_places import *
import json

# Get the data as json
print(get_cities())
print(get_wards())
print(get_provinces())
print(get_districts())

# Get the data as a list of dictionaries, remember you can customize the list to suit your need
data = json.loads(get_wards())
list_of_wards = [{i['Ward'] + ' ' + i['Province_OR_District']} for i in data.values()]
print(list_of_wards)

data = json.loads(get_districts())
list_of_districts = [{i['District'] + ' ' + i['Province']} for i in data.values()]
print(list_of_districts)

data = json.loads(get_provinces())
list_of_provinces = [{i['Province'] + ' ' + i['Capital'] + i['Area(km2)'] + i['Population(2012 census)']} for i in data.values()]
print(list_of_provinces)

data = json.loads(get_cities())
list_of_cities = [{i['City'] + ' ' + i['Province']} for i in data.values()]
print(list_of_cities)

License

The project is licensed under the MIT license.

About

This is a python package to get wards, districts,cities and provinces in Zimbabwe

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages