Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
Source by www.google.com #
 
PREVIOUS NEXT
Tagged: #dict #file #py
ADD COMMENT
Topic
Name
9+1 =