This log is reproduced, the original link: http://skandgjxa.blog.163.com/blog/static/1415298201010262403483/eval (str [, Globals [, locals]]) function treats the string str as a valid Python tableTo evaluate the value and return the result of the
The eval (str [, Globals [, locals]) function evaluates the string str as a valid Python expression and returns the result of the calculation.Similarly, the EXEC statement executes the string str as valid Python code. The namespace of the code
The eval (STR [, globals [, locals]) function evaluates the string 'str' as a valid Python expression and returns the calculation result.
Similarly, the exec statement executes the string STR as a valid Python code. The namespace provided to the
Eval (), exec (), execfile (), evalexecexecfile
Eval(Expression[,Globals[,Locals])
The eval () function executes a python expression string and returns the result after the expression is executed:
>>> x = 1>>> eval('x + 1')2
ExpressionThe parameter
After careful study, I learned three functions:Eval: Evaluating an expression in a stringEXEC: Executing a statement in a stringExecFile: Used to execute a file
It should be noted that EXEC is a statement, while Eval () and execfile () are built-in
1. abs (x)
The abs () function returns the absolute value of a number (common, long, or floating point. If a plural number is given, the return value is the modulo of the plural number. For example:
>>> Print abs (-2, 4)
2.4
>>> Print abs (4 + 2j)
1. ABS (x)The ABS () function returns the absolute value of a number (which can be a normal, long, or floating-point type). If the plural is given, the return value is the modulus of the complex number. For example:>>>print ABS ( -2,4)2.4>>>print
Supporting Python 3 (Python 3 supported)
About the book
About terminology
Order
Welcome to Python 3
Is it time now?
What if I can't switch now?
Python and its version
More Resources
Reprint: http://www.cnblogs.com/dsky/archive/2012/06/04/2535397.html1, Idle is a python package comes with an integrated development environment, beginners can use it to easily create, run, test and debug Python programs.First, idle installation in
: Network Disk DownloadContent Introduction· · · · · ·This book is a complete guide for Python developers-full upgrade for Python 2.5• Learn the professional Python style, best practices and good programming habits;• Enhanced in-depth understanding
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.