In this program, we will learn how to extract city details using zipcode
in Python.
First, we need to install geopy
. Run the below command to install geopy
pip install geopy
Here is the main program ๐
from geopy.geocoders import Nominatim
locator = Nominatim(user_agent='python100')
zipcode = input('Enter the zipcode of your city: ')
print(f'\nCity Details: {locator.geocode(zipcode)}')
Output:
Enter the zipcode of your city: 560005
City Details: Thanisandra, Yelahanka Zone, Bengaluru, Bangalore East, Bangalore Urban, Karnataka, 560005, India
Thanks for reading. I hope you like this content. if you have any questions ask me the comments below.