m="monday"
s="sunday"
def foo(**kws):
loc = locals()#把locals()方法
print(loc)
print(kws) # 这样试试
for i in kws:
print(i,"=",kws[i])
foo(s=s)
print("********************")
# 现在的打印效果some code monday
# 希望的打印效果 t monday
import inspect
def foo2(s):
arg_name = [n for n, v in inspect.currentframe().f_back.f_locals.items()
if v is s][0]
print(f'{arg_name} -> {s}')
foo2(m)
foo2(s)



