this is my code :
a = \\ \'\'\'def fun():\\n print \'bbb\' \'\'\' eval(a) fun()
but it shows error :
Traceback (most r
If your logic is very simple (i.e., one line), you could eval a lambda expression:
a = eval("lambda x: print('hello {0}'.format(x))") a("world") # prints "hello world"
As others have mentioned, it is probably best to avoid eval if you can.