📜  Python内置函数

📅  最后修改于: 2022-05-13 01:55:46.379000             🧑  作者: Mango

Python内置函数

Python提供了许多简化代码编写的内置函数。在本文中,您将找到Python的所有内置函数的列表。

Python内置函数列表

Function NameDescription
Python abs()Return the absolute value of a number
Python all()Return true if all the elements of a given iterable( List, Dictionary, Tuple, set, etc) are True else it returns False
Python any() Returns true if any of the elements of a given iterable( List, Dictionary, Tuple, set, etc) are True else it returns False 
Python ascii()Returns a string containing a printable representation of an object
Python bin()Convert integer to binary string
Python bool()Return or convert a value to a Boolean value i.e., True or False
Python bytearray()Returns a bytearray object which is an array of given bytes
Python bytes()Converts an object to immutable byte represented object of given size and data
Python callable()Returns True if the object passed appears to be callable
Python chr()Returns a string representing a character whose Unicode code point is an integer
Python classmethod()Returns a class method for a given function
Python compile()Returns a Python code object
Python complex()Creates Complex Number
Python delattr()Delete the named attribute from the object
Python dict()Creates a Python Dictionary
Python dir()Returns list of the attributes and methods of any object
Python divmod()Takes two numbers and returns a pair of numbers consisting of their quotient and remainder
Python enumerate()Adds a counter to an iterable and returns it in a form of enumerating object
Python eval()Parses the expression passed to it and runs python expression(code) within the program
Python exec()Used for the dynamic execution of the program
Python filter()Filters the given sequence with the help of a function that tests each element in the sequence to be true or not
Python float()Return a floating-point number from a number or a string
Python format()Formats a specified value
Python frozenset()Returns immutable frozenset
Python getattr()Access the attribute value of an object
Python globals()Returns the dictionary of current global symbol table
Python hasattr()Check if an object has the given named attribute and return true if present
Python hash()Encode the data into unrecognizable value
Python help()Display the documentation of modules, functions, classes, keywords, etc
Python hex()Convert an integer number into its corresponding hexadecimal form
Python id()Return the identity of an object
Python input()Take input from user as a string
Python int()Converts a number in given base to decimal
Python isinstance()Checks if the objects belong to certain class or not
Python issubclass()Check if a class is a subclass of another class or not
Python iter()Convert an iterable to iterator
Python len()Returns the length of the object
Python list()Creates a list in Python
Python locals()Returns the dictionary of the current local symbol table
Python map()Returns a map object(which is an iterator) of the results after applying the given function to each item of a given iterable
Python max()Returns the largest item in an iterable or the largest of two or more arguments
Python memoryview()Returns memory view of an argument
Python min()Returns the smallest item in an iterable or the smallest of two or more arguments
Python next()Receives the next item from the iterator
Python object()Returns a new object
Python oct()returns octal representation of integer in a string format.
Python open()Open a file and return its object
Python ord()Returns the Unicode equivalence of the passed argument
Python pow()Compute the power of a number
Python print()Print output to the console
Python property()Create property of a class
Python range()Generate a sequence of numbers
Python repr()Return intable version of the object
Python reversed()Returns an iterator that accesses the given sequence in the reverse order
Python round()Rounds off to the given number of digits and returns the floating-point number
Python set()Convert any of the iterable to sequence of iterable elements with distinct elements
Python setattr()Assign the object attribute its value
Python slice()Returns a slice object
Python sorted()Returns a list with the elements in sorted manner, without modifying the original sequence
Python staticmethod()Converts a message into static message
Python str()Returns the string version of the object
Python sum()Sums up the numbers in the list
Python super()Returns a temporary object of the superclass
Python tuple()Creates a tuple in Python
Python type()Returns the type of the object
Python vars()Returns the __dict__ attribute for a module, class, instance, or any other object
Python zip()Maps the similar index of multiple containers
Python __import__()Imports the module during runtime