跟老齐学Python之print详解
eval()
在print干事情之前,先看看这个东东。不是没有用,因为说不定某些时候要用到。
>>>help(eval) #这个是一招鲜,凡是不理解怎么用,就用这个看文档
Helponbuilt-infunctionevalinmodule__builtin__:
eval(...) eval(source[,globals[,locals]])->value
Evaluatethesourceinthecontextofglobalsandlocals. ThesourcemaybeastringrepresentingaPythonexpression oracodeobjectasreturnedbycompile(). Theglobalsmustbeadictionaryandlocalscanbeanymapping, defaultingtothecurrentglobalsandlocals. Ifonlyglobalsisgiven,localsdefaultstoit.