app.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from geopy.geocoders import Nominatim def get_coordinates(address): geolocator = Nominatim(user_agent="geoapi_example") location = geolocator.geocode(address) if location: print(f"Address: {address}") print(f"Latitude: {location.latitude}") print(f"Longitude: {location.longitude}") else: print(f"Could not find coordinates for: {address}") # Example usage if __name__ == "__main__": address = input("Enter the address: ") get_coordinates(address) |