import requests
import json
from time import sleep
import sys
try:
while True:
sleep(2)
response = requests.get("https://api.binance.us/api/v3/ticker/price?symbol=DOGEUSD")
output = response.json()
data = json.dumps(output['price'])
punctuation = '''"'''
remove_punct = ""
for character in data:
if character not in punctuation:
remove_punct = remove_punct + character
doge_ammout = float(805.77685148)
price = remove_punct
price_as_float = float(price)
net_profit = str(price_as_float * doge_ammout)
print('current price of doge: '+ price, flush = True)
print('how much doge you have: ' + net_profit + '\r', flush = True)
sys.stdout.flush()
except KeyboardInterrupt:
exit('\n')
i want there to be two lines without it making a new line every update every time it runs it either makes a new pair of lines or combines the strings together or overwriting the string