我有以下词典列表:
"errorlist": [
{
"error": "Not found",
"path": "/tmp/working/directory1/file1"
},
{
"error": "Not found",
"path": "/tmp/working/directory2/file1"
},
{
"error": "Not found",
"path": "/tmp/working/directory1/file2"
},
{
"error": "Not found",
"path": "/tmp/working/directory2/file2"
}
]
我想删除路径值中的“/tmp/working/”部分,即将绝对路径转换为相对路径。
我在网上搜索时也遇到过类似的问题,但没有找到解决方案。应该很简单,但我就是想不明白。
预期结果应该是具有更新值的原始列表或具有相同结构的新列表。