from forex_python.converter import CurrencyRates # Create a new instance of the CurrencyRates class cr = CurrencyRates() # Get the latest exchange rate for USD to EUR rate = cr.get_rate('USD', 'EUR') print(f"1 USD = {rate} EUR")
pip install forex-pythonOverall, the `CurrencyRates` class is a useful tool for fetching exchange rates in Python, and the `forex_python` package provides a straightforward API for utilizing this functionality.