this is my code:
a= {'u':exec("def u(str):return Unicode(str,'utf-8')"),}
print a
but it show error :
SyntaxError: invalid syntax
(mysite)zjm1126@zjm1126-G41MT-S2:~/桌面/test$ python a.py
File "a.py", line 5
a= {'u':exec("def u(str):return Unicode(str,'utf-8')"),}
^
SyntaxError: invalid syntax
i wiil stored it to my company’s database , it must be a dict ,
what can i do ,
thanks
Alternatives would be to store the function instead, or the code as text:
or
and then execute it as