I have a function f(x) in which many local variables are created. x is a string with the same name as one of these local variables and I would like
f(x)
x
If your input is a string and you want to refer to a variable that matches that string you can use globals() like this:
globals()
globals()['x']
This way you can get the value and/or edit its contents.