I tried a lot however still have a problem with returning dictionaries from a function. I can e.g print d1 and d2 from inside the function but not outside. When I use the following script I get: NameError: name 'd1' is not defined. Thank you for your help!
ref = """text a"""
target = """text b"""
def text_to_dict(x):
# value formatting to list = new_values
# key formatting to list = keys
# dict creation from keys and new_values
if x == ref:
d1 = dict(zip(keys, new_values))
return d1
elif x == target:
d2 = dict(zip(keys, new_values))
return d2
text_to_dict(ref)
text_to_dict(target)
print(d1)
print(d2)