Answers for "how to make a dict from a file py"

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)
Posted by: Guest on March-12-2022

Code answers related to "how to make a dict from a file py"

Python Answers by Framework

Browse Popular Code Answers by Language