【发布时间】:2018-12-04 08:31:57
【问题描述】:
我有如下嵌套的dict:
u'dvlRaw':{
u'diagnosticInfoUDP': {
u'clientConnected': array([0, 0, 0, 0, 0, 0, 0,0, 0,0], dtype=uint8),
u'channel': array([1, 1, 1, ..., 1, 1, 1], dtype=uint32)
}
}
如何删除其中包含整个零数组的键值对。 零数组的位置可能不是恒定的,有时可能是 child_dictionary 的值,有时可能是 child_dictionary 的孩子的值。 是否有一种通用的方法可以删除它可能位于的任何 child_dictionary 中出现的零数组
【问题讨论】:
-
正确格式化您的代码
-
到目前为止你有什么尝试?
-
你能提供一个minimal reproducible example吗?您现在正在评论答案,因为您的问题比您描述的更广泛。请相应地edit your question。
标签: python numpy dictionary