f = open("部门.txt", mode="r", encoding="utf-8")
first_list = f.readline()
head_list = first_list.split()
print(head_list)
list1 = []
dic1 = {}
for line in f:
line = line.strip()
date_list = line.split()
print(date_list)
for i in range(len(head_list)):
# print(i)
dic1[head_list[i]] = date_list[i]
# print(dic1)
# print(dic1)
list1.append(dic1)
print(list1)
f.close()
![](http://tiebapic.baidu.com/forum/w%3D580/sign=3ba2e42786cec3fd8b3ea77de68ad4b6/06be9e82d158ccbfee31acd15cd8bc3eb0354128.jpg?tbpicau=2024-09-18-05_beaeb048c6429099fad4743a310715c5)
first_list = f.readline()
head_list = first_list.split()
print(head_list)
list1 = []
dic1 = {}
for line in f:
line = line.strip()
date_list = line.split()
print(date_list)
for i in range(len(head_list)):
# print(i)
dic1[head_list[i]] = date_list[i]
# print(dic1)
# print(dic1)
list1.append(dic1)
print(list1)
f.close()
![](http://tiebapic.baidu.com/forum/w%3D580/sign=3ba2e42786cec3fd8b3ea77de68ad4b6/06be9e82d158ccbfee31acd15cd8bc3eb0354128.jpg?tbpicau=2024-09-18-05_beaeb048c6429099fad4743a310715c5)