从字典列表中每次打印一个字典到表



我想只打印Tom的代码到一个表,而不使用函数

fe=[{"Name": "Tom", "age": 10,"group":"sdd","points":2,},
{"Name": "Mark", "age": 5,"group":"sdo","points":6,},
{"Name": "Pam", "age": 7,"group":"spp","points":4,}],
dashes = "{:<20} + {:<8} + {:^14} + {:^11} n".format("-"*20, "-"*8, "-"*10, "-"*14, "-"*11)
info ="{:<20} | {:<8} | {:^14} | {:^11}n".format("Name", "age", "group","points")
info+=dashes    
value=0
fe[value]
info+="{:<20} | {:<8} | {:^14} | {:^11} n".format(value["Name"],value["age"],value["group"],value["points"])
info+=dashes
print(info) 

value0

value = fe[0]
info += "{:<20} | {:<8} | {:^14} | {:^11} n".format(value["Name"],value["age"],value["group"],value["points"])

相关内容

  • 没有找到相关文章

最新更新