I have written the below program wherein I am trying to modify the dictionary values
present in local symbol table
:
def modify_locals():
str = True
print(locals())
locals()['str'] = False
print(locals())
modify_locals()
Output:
{'str': True}
{'str': True}
Please let me know why locals()['str'] = False
is not updating the local symbol table
?