我怎样才能得到以下代码?我想为变量Reputation Risk_22may_only
赋值。我从here获得了以下代码。但它对我不起作用
risk_type="Reputation Risk"
xxx1=risk_type + "_22may_only"
exec(xxx1 + " = 'something else'")
exec(xxx1 + " = 'something else'")
Traceback (most recent call last):
File "C:\IPython\core\interactiveshell.py", line 2862, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-38-c9a2a2cf48c3>", line 1, in <module>
exec(xxx1 + " = 'something else'")
File "<string>", line 1
Reputation Risk_22may_only = 'something else'
^
SyntaxError: invalid syntax