如果我理解正确的话,您真的希望从json打印数据,而不是从中介数组。
所以:
print(data['Male']) # will print the entire Male subsection
print(data['Male']['Jack']) # will print the entire Jack record
print(data['Male']['Jack']['telephone']) # will print Jack's telephone
但要将其与中介数组联系起来:
print(data[a[0]]) # will print the entire Male subsection
print(data[a[0]][b[0]]) # will print the entire Jack record
print(data[a[0]][b[0]][c[0]]) # will print Jack's telephone
假设你申报
a
正确地:
a = ['Male', 'Female'] # Notice the capitals