Lambda expression +python built-in functions

Source: Internet
Author: User

The traditional way of defining functions is as follows

def F1 ():     return 123

Lambda expression definition function

Lambda : 123

Python3 built-in functions

1.abs Absolute Value

i = ABS ( -11)print (i)

The output is 11.

ABS = Absolute

2,all loop parameter, returns True if each element is true

R = All ([true, True])print (r)

In Python 0 () [] ' and none are false (Null values are false)

R = All (["123","" ", [up],""])print (r)

Return to False

3,any as long as one is true

i = any ([None,"","123"])print (i)

Return to True

4,ASCII automatically executes ASCII (object) to the class of the object, look for __reper__, get the return value

class Foo:     def __repr__ (self):         return " Hello "  == ASCII (obj)print (r)

The return value is Hello

5,bin () binary Oct () octal int () decimal hex () hex

6,bool judge true or false: essentially converts an object to a Boolean value

7,bytes (bytes) bytesarray (byte list)

Complement the conversion between bytes and strings

Bytes ("xxxxx", encoding= "Uft-8")

8,CHR () Ord ()

c = Chr (65)

Print (c)

The return value is a

Chr finds the corresponding ASCII code character (ASCII is a character corresponding to a byte)

Same as Ord (a)

Returns 97 converts a character to a number by Ord

Lambda expression +python built-in functions

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.