所以,我希望这段代码让用户输入狗狗链地址,然后我得到那个地址的余额。当我执行这个我得到错误:
url = "https://dogechain.info/api/v1/address/balance/"+ a
错误:
TypeError: cannot concatenate 'str' and 'int' objects
代码:
import requests
def main():
a = input("Address?")
url = "https://dogechain.info/api/v1/address/balance/"+ a
response = requests.get(url)
bal = response.json()[0]["balance"]
print("Balance:",bal)
main()