跟老齐学Python之print详解

786次阅读  |  发布于5年以前

eval()

在print干事情之前,先看看这个东东。不是没有用,因为说不定某些时候要用到。

复制代码 代码如下:

help(eval) #这个是一招鲜,凡是不理解怎么用,就用这个看文档

Help on built-in function eval in module builtin:

eval(...)
eval(source[, globals[, locals]]) -> value

Evaluate the source in the context of globals and locals.  
The source may be a string representing a Python expression  
or a code object as returned by compile().  
The globals must be a dictionary and locals can be any mapping,  
defaulting to the current globals and locals.  
If only globals is given, locals defaults to it.  

Copyright© 2013-2020

All Rights Reserved 京ICP备2023019179号-8