how can convert contents in text file to dictionary in python code example
Example: make dictionary from text file python
d = {}
with open("file.txt") as f:
for line in f:
(key, val) = line.split()
d[int(key)] = val
d = {}
with open("file.txt") as f:
for line in f:
(key, val) = line.split()
d[int(key)] = val