with open("yester.txt","r",encoding="utf-8") as f:
user_dict={}
for userline in f:
userline=str(userline).replace('\n','')
user_dict[userline.split(' ',1)[0]]=userline.split(' ',1)[1]
txt文件:
a ah
a ey
cat k ae t
of ah v
peck p eh k
peppers p eh p er z
peter p iy t er
picked p ih k t
pickled p ih k ah l d
piper p ay p er
the dh ah
the dh iy