Importance of eval, exec, execfile, compile; and the py_compile module: eval(str,globals,locals) This function executes an expression string and returns the result. >>> eval('2+3') 5 >>> eval("'udhay'*3") 'udhayudhayudhay' #exec statement executes a string containing arbitrary python code >>> exec("print 'Hello'") Hello >>> exec('2+34') >>> a=[1,2,3,45] >>> exec "for i in a: print i" 1 2 3 45 >>> #execfile(filename,globals,locals) -function executes the contents of a file ... >>> exec...
About Python, Node.js, Matlab tutorials and NS-2 tutorials