I have a method to read from a file and assign the contents to a variable.
def recall_data(self, file, d):
try:
with open(file) as f:
d = json.load(f)
print(d)
except FileNotFoundError:
print('No File!')
I call the method and know that the value of d is assigned to the contents of the file (a dictionary). However, the code doesn't store the value of d in the variable I pass as d.
self.recall_data(self.file_name, self.data)
This is my method call. self.data is an empty dictionary. I don't understand why it isn't assigning self.data with the contents of self.file_name.