I am making a price ticker for reddit. Everything is working fine, but the API that it derives the price from has 4 decimal places, and a comma in it dividing the thousands.
I am just trying to figure out how to round the number to either 2 decimals, or a whole number. So far I have tried the round() function, which does not work because of the comma. I was able to remove the comma, but it still won't let me use the round function.
def main(self):
req = requests.get('https://api.coindesk.com/v1/bpi/currentprice.json')
req = req.json()
dollar = '1 BTC = $' + req['bpi']['USD']['rate'].replace(',' , '')
Any ideas?