我是Python新手,希望有人能帮我 我尝试了这个,但是我得到了一个错误:TypeError:NoneType类型的参数不可iterable 我想问题是有些值是无的,我不能删除一些无的?你知道吗
etheurticker= finexticker.get('ETH/EUR')
if 'askVolume' and 'bidVolume' and 'vwap' and 'open' and 'previousClose' and
'change' and 'percentage' and 'baseVolume' and 'quoteVolume' and 'info'and
'average' in etheurticker:
del etheurticker['askVolume']
del etheurticker['bidVolume']
del etheurticker['vwap']
del etheurticker['open']
del etheurticker['previousClose']
del etheurticker['change']
del etheurticker['percentage']
del etheurticker['baseVolume']
del etheurticker['quoteVolume']
del etheurticker['info']
del etheurticker['average']
这是一本没有清除的词典:
{'symbol': 'ETH/EUR', 'timestamp': 1529160540908.2085, 'datetime': '2018-06-
16T14:49:01.908Z', 'high': 440.45, 'low': 416.57356472, 'bid': 422.75,
'bidVolume': None, 'ask': 422.77, 'askVolume': None, 'vwap': None, 'open':None, 'close': 422.76, 'last': 422.76, 'previousClose': None, 'change': None, 'percentage': None, 'average': 422.76, 'baseVolume': 3318.1630349899992, 'quoteVolume': None, 'info': {'mid': '422.76', 'bid': '422.75', 'ask': '422.77', 'last_price': '422.76', 'low': '416.57356472', 'high': '440.45', 'volume': '3318.1630349899992', 'timestamp': '1529160540.908208614', 'pair': 'ETHEUR'}}
希望有人能帮我:)
您可以这样删除它们:
输出:
不管您试图解释为什么要这样做,下面是您实际如何设置该条件(使用一个较小的示例):
请注意,
vwap
设置为None
并不重要相关问题 更多 >
编程相关推荐