I am new to python - however have encountered a problem
I have a file saved which looks like:
a,1
b,2
c,3
I can convert this to a dictionary by using this code:
file = open("dict.txt",'r')
dictionary = {}
for line in file:
x = line.split(",")
key = x[0]
value = x[1]
value = value [:-1]
dictionary[key] = value
There is code that allows the user to element (so dictionary now consists of a:1, b:2, c:3, d:4)
However, I need to get the dictionary in the form mentioned above
So
a,1
b,2
c,3
d,4
Is this possible?
Also if some explanations could go with the answer I'd appreciate it