@[toc]
Python 获得对象的字段列表
obj = {
"key1": "value1",
"key2": "value2",
"key3": "value3",
"key4": "value4",
"key5": "value5",
"key6": "value6",
}
if __name__ == '__main__':
for key in obj.items():
print(key[0], key[1], sep=":")
输出
key1:value1
key2:value2
key3:value3
key4:value4
key5:value5
key6:value6