How to form a dictionary of file and attributes in python
Code examples
0
0
how to make a dict from a file py
dictionary = {}
file = open("data.txt")
for line in file:
key, value = line. split() # Split line into a tuple.
dictionary[key] = value # Add tuple values to dictionary.
print(dictionary)