How do I create a dictionary in python that is passed to a function so it would look like this:
def foobar(dict):
dict = tempdict # I want tempdict to not point to dict, but to be a different dict
#logic that modifies tempdict
return tempdict
How do I do this?
You need to copy dict to tempdict.
copymakes a shallow copy of the dict (i.e. copying its values, but not its values’ values).