Python program to Read Text from File to Dictionary

goods = {}
for i in open("C:/Users/USER/Desktop/Python.txt"):
 cate = i.split()
 cate[1] = (cate[1])
 cate[2] = (cate[2])
 goods[cate[0]] = cate[1:]
print(goods)

 

 

 

Output:

 

{'Hello': ['World', '6']}

   

 

Subscribe For Daily Updates