Module to translate city names to time zone names
Project description
tzcity
A module to find the Olson database time zone names of some of the most populous cities in the world without an internet connection.
Only a few cities associated with each time zone are recognized to minimize the size of data bundled with the package.
Installation
You need Python>=3.6 to use tzcity.
It can be installed from PyPI with pip using
pip install tzcity
Usage
tzcity.tzcity(city: str) -> str
Accepts a city name and returns the time zone name associated with that city.
Raises UnknownTZCityException
if unable to recognize city.
>>> tzcity.tzcity('abu dhabi')
'Asia/Dubai'
>>> tzcity.tzcity('bandar seri begawan')
'Asia/Brunei'
>>> tzcity.tzcity('myanmar') # a country with only one time zone
'Asia/Yangon'
tzcity.capitalize(name: str) -> str
Capitalize the city or time zone name provided as argument.
Raises UnknownTZCityException
if unable to recognize name.
>>> tzcity.capitalize('andorra la vella')
'Andorra la Vella'
>>> tzcity.capitalize("new york")
'New York'
>>> tzcity.capitalize("dumont d'urville")
"Dumont d'Urville"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.