day30 --- built-in function

The abs () function returns the absolute value of a number. 
The all () function is used to determine whether all elements in the given iterable parameter iterable are TRUE, if it returns True, otherwise it returns False. 
The any () function is used to judge whether the given iterable parameter iterable is all False, then return False, if one is True, return True. 
The basestring () method is a superclass (superclass) of str and unicode, and is also an abstract class, so it cannot be called and instantiated, but can be used to determine whether an object is 
    an instance of str or unicode, isinstance (obj, basestring) Equivalent to isinstance (obj, (str, unicode)). 
bin () returns a binary representation of an integer int or long int. 
The bool () function is used to convert a given parameter to a boolean type. If there is no parameter, it returns False. 
The bytearray () method returns a new byte array. The elements in this array are variable, and the range of values ​​for each element is: 0 <= x <256 . 
The callable () function is used to check whether an object is callable. If it returns True, the object may still fail to call; but if it returns False, the object called will never succeed. 
chr () takes an integer in the range ( 256) (that is, 0 to 255 ) as a parameter and returns a corresponding character.
The function corresponding to the classmethod modifier does not need to be instantiated and does not require the self parameter, but the first parameter needs to be the cls parameter that represents its own class, which can be used to call the properties of the class, the methods of the class, and the instantiated object. 
The cmp (x, y) function is used to compare two objects, if x <y returns -1, if x == y returns 0, if x> y returns 1 . 
The compile () function compiles a string into byte code. 
The complex () function is used to create a complex number with the value real + imag * j or convert a string or number to a complex number. If the first parameter is a string, you do not need to specify the second parameter. . 
The dict () function is used to create a dictionary. 
When the dir () function takes no parameters, it returns a list of variables, methods, and defined types in the current scope; when it takes parameters, it returns a list of the attributes and methods of the parameters. 
    If the parameter contains the method __dir __ (), the method will be called. If the parameter does not contain __dir __ (), this method will maximize the collection of parameter information. 
The python divmod () function combines the results of divisor and remainder operations and returns a tuple containing the quotient and remainder (a // b, a% b). 
    Before Python 2.3, complex numbers were not allowed. 
The enumerate () function is used to combine a traversable data object (such as a list, tuple, or string) into an index sequence. It also lists data and data subscripts. It is generally used in a for loop. 
Python 2.3. The above version is available, and the start parameter is added in 2.6 . 
The eval () function is used to execute a string expression and return the value of the expression. 
execfile () function can be used to execute a file. 
The file () function is used to create a file object. It has an alias called open (), which is more vivid. They are built-in functions. The parameters are passed as strings. 
    More file operations can refer to: Python file I / O. 
The filter () function is used to filter sequences, filter out elements that do not meet the conditions, and return a new list of elements that meet the conditions. 
    It receives two parameters, the first is a function and the second is a sequence. Each element of the sequence is passed as a parameter to the function for judgment, and then returns True or False. Finally, the element that returns True is placed in the new list. 
The float () function is used to convert integers and strings to floating point numbers. 
Python2. . 6 starts, a new function of formatting str.format string (), which enhances the string formatting functions. 
    The basic syntax {} and by: in place of the previous % . 
    The format function can accept an unlimited number of parameters, and the positions can be out of order. 
frozenset () returns a frozen collection. After freezing, the collection cannot add or delete any elements. 
The getattr () function returns an object attribute value. 
The globals () function will return all global variables at the current position as a dictionary. 
The hasattr () function is used to determine whether the object contains corresponding attributes. 
hash () is used to obtain the hash value of an object (string or numeric value).
The help () function is used to view a detailed description of the purpose of the function or module. 
The hex () function is used to convert a decimal integer to hexadecimal, expressed as a string. 
The id () function returns the unique identifier of the object. The identifier is an integer. 
The input () function in Python 3.x accepts a standard input data and returns it as a string type. 
    In Python2.x, input () is equal to eval (raw_input (prompt)), which is used to get the input of the console. 
    raw_input () treats all inputs as strings and returns the string type. And input () has its own characteristics when dealing with pure digital input. It returns the type of the input number (int, float). 
The int () function is used to convert a string or number to an integer. 
The isinstance () function determines whether an object is of a known type, similar to type (). 
The issubclass () method is used to determine whether the parameter 
The long () function converts a number or string to a long integer.class is a subclass of the type parameter classinfo. 
The iter () function is used to generate an iterator. 
The list () method is used to convert tuples to lists. 
The locals () function returns all local variables at the current position as a dictionary. 
    For functions, methods, lambda functions, classes, and class instances that implement the __call__ method, it returns True. 
map () will map the specified sequence according to the provided function.
    The first parameter function calls the function function with each element in the parameter sequence, returning a new list containing the value returned by each function function. 
The max () method returns the maximum value of a given parameter, which can be a sequence. 
The memoryview () function returns the memory view object (Momory view) with the given parameters. 
    The so-called memory view object refers to the packaging of data that supports the buffer protocol and allows Python code access without copying the object. 
The min () method returns the minimum value of a given parameter, which can be a sequence. 
next () returns the next item of the iterator. 
    The next () function is used with the iter () function that generates the iterator. 
The oct () function converts an integer to an octal string. 
The python open () function is used to open a file and create a file object, and related methods can call it for reading and writing. 
The ord () function is a pairing function of the chr () function (for 8-bit ASCII strings) or the unichr () function (for Unicode objects). It takes a character (a string of length 1) as a parameter and 
  returns the corresponding ASCII value, or Unicode value, if the given Unicode character exceeds the range defined by your Python, it will raise a TypeError exception. 
The pow () method returns the value of xy (x raised to the y power). 
The print () method is used to print out the most common function. 
    In A Python 3. 3The version adds the flush keyword parameter. 
The purpose of the property () function is to return the property value in a new-style class. 
The python range () function can create a list of integers and is generally used in a 
The sorted () function sorts all iterable objects.for loop. 
python raw_input () is used to get input from the console. 
    raw_input () treats all inputs as strings and returns the string type. 
The reduce () function accumulates the elements in the parameter sequence. 
        The function performs the following operations on all the data in a data set (linked list, tuple, etc.): The function passed to the reduce function (with two parameters) first operates on the first and second elements in 
        the set The result is calculated with the third data using the function function, and finally a result is obtained. 
reload () is used to reload the previously loaded module. 
The repr () function converts the object into a form that can be read by the interpreter. 
The reverse () function is used to reverse the elements in the list. 
The round () method returns the rounded value of the floating-point number x. 
The set () function creates an unordered set of non-repetitive elements, which can be used to test relationships, remove duplicate data, and also calculate intersections, differences, and unions. 
The setattr () function corresponds to the function getattr (), which is used to set the attribute value, which does not necessarily exist. 
The slice () function implements a slice object, which is mainly used to pass parameters in slice operation functions. 
python staticmethod returns the static method of the function. 
The str () function transforms the object into a form suitable for human reading.
The sum () method sums the series. 
The super () function is a method for calling the parent class (superclass). 
    super is used to solve the problem of multiple inheritance. Directly calling the parent class method with the name of the class is no problem when using single inheritance, but if multiple inheritance is used, it will involve search order (MRO), repeated calls (diamond inheritance) problem. 
    MRO is the sequence table of class method resolution, which is actually the sequence table when inheriting the methods of the parent class. 
The Python tuple () function converts a list to a tuple. 
The type () function returns the type of the object if you only have the first parameter, and the new type object with three parameters. 
The unichr () function is basically the same as the chr () function, except that it returns unicode characters. 
The vars () function returns a dictionary object of the attributes and value of the object object. 
The usage of the xrange () function is exactly the same as range, the difference is that it does not generate an array, but a generator. 
The zip () function takes an iterable object as a parameter, packs the corresponding elements in the object into tuples, and then returns a list of these tuples. 
    If the number of elements in each iterator is inconsistent, the length of the returned list is the same as the shortest object. Using the * operator, you can decompress the tuple into a list.
The __import__ () function is used to dynamically load classes and functions. 
    If a module changes frequently, you can use __import__ () to dynamically load it.

 

Guess you like

Origin www.cnblogs.com/surpass123/p/12678760.html