我正在使用Python,当我回忆起所有可用硬币的价格时,经常会遇到一个我无法过滤的错误“[error]没有符号XXX的数据”
代码如下:
import requests
import datetime
import cryptocompare
import datetime
coin_list = cryptocompare.get_coin_list(format=False)
date_today = datetime.datetime.now()
for coin, data in coin_list.items():
nowprice = cryptocompare.get_historical_price(coin, 'USD', date_today)
print (nowprice)
为什么我得到这个错误?有办法避免吗? 我如何过滤错误,使它不显示在屏幕上呢?
谢谢!!!
这是因为您使用的API(https://www.cryptocompare.com/api/) 没有一些货币的历史信息,例如https://www.cryptocompare.com/coins/nvst/overview。除了忽略这些货币,你别无选择。在
您必须编辑
cryptocompare.py
(https://stackoverflow.com/a/12950101/5270506),并将query_cryptocompare
函数更改为:相关问题 更多 >
编程相关推荐