我想把所有的name提取出来
本帖最后由 红唇如刀 于 2020-7-16 00:19 编辑import json
str1 = '''
[{
"name": "Tom",
"gender": "male"
}, {
"name": "Jack",
"gender": "male"
},
{
"name": "John",
"gender": "male"
}]
'''
data = json.loads(str1)
print(type(data))
print(data)
如何能同时得到name后面的Tom和Jack和John?
求路过的大侠出手相助!!!!!!!! import json
str1 = '''
[{
"name": "Tom",
"gender": "male"
}, {
"name": "Jack",
"gender": "male"
},
{
"name": "John",
"gender": "male"
}]
'''
data = json.loads(str1)
for i in data:
print(i['name'])
输出结果:
Tom
Jack
John
Twilight6 发表于 2020-7-16 00:11
输出结果:
谢谢大侠
页:
[1]