Built in functions in Python

This article is used to record built-in functions in Python. andIts functions are supplemented at any time.

Complete built-in functions and their descriptions are available in the official documentation: https://docs.python.org/3.5/library/functions.html

Universal built in function:

    id() Function: look at the memory address of the object;

    help()Function: view help information;

    type()Function: look at the type of the object; do not think that the subclass is a parent type.

    isinstance()Function: view object type; think subclass is a kind of parent class;

    dir()Function: to see properties and methods in objects;

    ord():Get the numeric encoding corresponding to a character.

         chr():The conversion from digital coding to character conversion is realized.

>>> ord('c')
99
>>> chr(9)
'\t'
>>> chr(3)
'\x03'
>>> chr(112)
'p'

 

Several types of built-in functions:

abs (x)”

ceil (x)”

cmp (x, y)”

if X & lt; y returns – 1; if x = = y returns 0; if X & gt; y returns 1. Python 3 has been discarded.Abandon. Use use (x> y) – (x< y) to replace.

exp (x)”

returns the X-Power (e x) of e, such as math. exp (1) returns 2.7182828459045

fabs (x)”

floor (x)”

log (x)”

log10 (x)”

returns the logarithm of x based on 10, such as math. log10 (100) returns 2.0.

max (x1, X2,…)”

min (x1, X2,…)”

modf (x)”

returns the integer part and the decimal part of X. The numeric symbols of the two parts are the same as x, and the integer part is represented by floating-point type.

pow (x, y)”

round” (x [n]])

returns the rounded value of the floating point x, and if n is given, represents the number of digits rounded to the decimal point.

sqrt (x)”

choice (SEQ)”

Random selection of an element from a sequence, such as random. choice (range (10)), and random selection of an integer from 0 to 9.

randrange ([start,” stop [step]]

Gets a random number from a set incremented by a specified cardinality within a specified range, with a default cardinality of 1.

random”.

seed ([x])”

shuffle (LST)”

uniform (x, y)”

acos (x)”

returns the arc cosine value of X.

asin (x)”

returns the arc arcs of X.

atan (x)”

atan2 (y, x)”

cos (x)”

hypot (x, y)”

sin (x)”

tan (x)”

degrees (x)”

radians (x)”

Posted on Categories default, php

Leave a Reply

Your email address will not be published. Required fields are marked *