我使用的是python json,我想让我的python代码在json文件中搜索specefic关键字
基本上,它应该搜索“profilename”,然后向下一行打印出配置文件的电子邮件
[
{
"profilename": "Test123"
"email": "reid.warren@undefined.name",
"phone": "+1 (983) 443-3504",
"address": "359 Rapelye Street, Holtville, Marshall Islands, 9692"
},
{
"profilename": "QTest123"
"email": "amelia.wilkinson@undefined.us",
"phone": "+1 (831) 563-3240",
"address": "525 Allen Avenue, Iola, Kentucky, 894"
}
]
就像代码应该搜索profilename“Test123”并打印出它的电子邮件一样,就像向下一行并打印出电子邮件一样
我尝试了很多方法,但我甚至没有更进一步,因此共享我当前的代码将有助于0:/
谢谢
StopIteration
发生在数据中没有profilename == Test123
时。有关词典搜索列表here的详细信息如果我理解正确,您正在尝试通过字段
profilename
查找配置文件并返回用户的email
输出:
reid.warren@undefined.name
要从文件加载配置文件,请执行以下操作:
相关问题 更多 >
编程相关推荐