序号 部门 人数 平均年龄 备注
1 python 30 26 单身狗
2 Linux 26 30 没对象
3 运营部 20 24 女生多
lst = []
with open("a1.txt", mode="r", encoding="utf-8") as f:
first = f.readline().strip().split(" ")
lst1 = []
for le in first:
if le != "":
lst1.append(le)
for line in f:
dic ={}
s = line.strip().split(" ")
lst2 =[]
for i in s:
if i != "":
lst2.append(i)
for j in range(len(lst1)):
dic[lst1[j]] = lst2[j]
lst.append(dic)
print(lst)