I'm implementing a Python code to create Graph
with open (filename, "r") as f:
d = {}
for line in f:
key, value = line.split()
if key not in d:
d[key] = [value]
else:
d[key].append(value)
But my Algorithm is returning the dictionary in string and not integer, look at my output:
{'1': ['2', '4', '5'], '0': ['1'], '3': ['2', '7'], '2': ['3 ',' 6 '],' 5 ': [' 6 '],' 4 ': [' 5 ',' 0 '],' 7 ': []' 6 ': [' 5 ',' 7 ']}
How do I convert to integer the key and value or get everything as integer?