Python built-in functions 2

Source: Internet
Author: User

When I look at my blog, I choose to die.

Divmod (A, b) #返回a//b values and remainder

s = divmod (97,10)
Print (s)
N1, N2 = Divmod (89,5)
Print (N1,N2)
Isinstance () #判断对象是否是某个类的实例 filter (function, iteration object)
Li = [11,22,33,44,55]
RET = filter (lambda a:a>30,li) #筛选, loop through the second argument, let each element execute the function, if the function value returns True, indicates that the element satisfies the filter condition.
 
 

Map (function, iterative object)

L1 = map (lambda a:a+100,li) #将函数的返回值添加到结果中
Print (list (L1))

Note: Filter adds an element that satisfies a condition to the result when the function execution result is true.

map is to add the result of the function's execution (the return value) to the result.
 Global () Globals () local variable hash () hash table bytes () converts characters to bytes

Python built-in functions 2

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.