Although I say I created it, it's a simple script, but there aren't many tools that do currency calculations, so I thought I had no choice but to create it myself, so I reluctantly made it.
It supports almost all currencies.
It converts to Japanese yen, but if you modify the code, you can also do dollar conversions and such.
from forex_python.converter import CurrencyRates
c = CurrencyRates()
import sys
args = sys.argv
# print(c.convert('CNY', 'JPY', 10))
print(c.convert(args[1], 'JPY', float(args[2])))
Usage
Do pip3 install forex-python, then do something like python3 script.py USD 100.
The output looks like this.
yuis@DESKTOP-UHU8FSH:/mnt/c/pg$ python3 /mnt/c/pg/calc_rate/calc_rate.py CNY 10
174.14999999999998
yuis@DESKTOP-UHU8FSH:/mnt/c/pg$ python3 /mnt/c/pg/calc_rate/calc_rate.py USD 10
1096.6
Summary
This was an introduction to an article about creating a Python script that calculates how much something is in Japanese yen based on currency exchange rates.
Thank you for reading to the end.