print的一些基本用法,在前面的讲述中也涉及一些,本讲是在复习的基础上,尽量再多点内容。
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 cur
来源gao!daima.com搞$代!码网
rent globals and locals.
If only globals is given, locals defaults to it.
以上就是跟老齐学Python之print详解的详细内容,更多请关注gaodaima搞代码网其它相关文章!