python - Python:从具有唯一字段的 JSON 对象列表中删除重复对象
问题描述
我使用 PyMongo 从 MongoDB 中检索了以下 JSON。某些字段filepath
对于每个对象都是唯一的。
[
{
"_id": {
"$oid": "614c342ad3c1c8e2945c8668"
},
"album": "Come Over When You're Sober, Pt. 2",
// some other fields
"filepath": "/music/.../....flac"
},
{
// some other objects
},
{
"_id": {
"$oid": "614c342dd3c1c8e2945c8c8c"
},
"album": "Come Over When You're Sober, Pt. 2",
// some other fields
"filepath": "/videos/...mp3"
}
]
我想通过检查每个对象的专辑字段来从此列表中删除重复项。
我怎样才能做到这一点?
解决方案
推荐阅读
- python - 如何让代码向后跳转而不是向前跳转?
- google-cloud-platform - 由于缺少 CMake,Google Cloud Build 失败
- firebase-realtime-database - 在 iOS 中的节点上更新值后,Firebase 节点意外删除自身
- javascript - 使用 background-image 属性制作动画是否最佳?
- python - 如何在终端外访问烧瓶应用程序?
- session-cookies - 负载均衡器的 Marklogic Rest API 事务问题
- python - AttributeError:'NoneType' 对象在基于空间分隔时没有属性'split'
- excel - 如何在excel中删除多个工作表中的重复值和原始值
- ruby-on-rails - 在 Rails+Passenger 服务器中启动应用程序作为服务
- raid - RAID5 故障,所有超级块丢失,无法重新组装阵列