Python built-in functions

Source: Internet
Author: User

ABS () absolute value

All ([1,2,3,4])-----------True

False:bool (None), bool ("'), bool ([]), BOOL (()), bool ({})

Any ([' "', [],{},none])-------False

Any ([' "', [],{},none,1])-------True

Ret=ascii (8) ==int __repr__ ()

Bin (Ten)-----0b1010//0b---Binary

ByteArray ("Publicity", encoding= ' utf-8 ')----to byte array

F=lambda x:x+1

F (5)

Callable (f)-----Ture----------F is capable of performing

Chr (----c ASCII transcoding ASCII code)

Ord (' a ')-----ASCII transcoding to Digital

Dir ()

Divmod ()

l=["Zy", "Zlj", "SB"]

For I in L:print (L)------------------ZY,ZLJ,SB

For I,item in Enumrate (l,1):p rint (i,item)---------1 Zy 2 Zlj 3 SB

For I,item in Enumrate (l,10):p rint (i,item)---------Zy one ZLJ

Enumerate ()

Eval ("6*8")------------48

Filter,map:

L=[11,22,33,44]

New_l=map (Lambda x:x+100,l)

For I in New_l:print (i)------111,122,133,144

Li=list (new_l)

Li------------[111,122,133,144]

def func (x)

If x>33:

Return True

Else

Return False

N=filter (fun,l)

List (n)----------44

Available Global variables: Globals

Available Local variables: locals

Oct----------Octal

Round (8.9)---------9 rounding

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.