| Draft for Information Only ContentPython Built-in FunctionsBuilt-in Functions
 Source and Reference
 
Python Built-in Functions
The Python interpreter has some built-in function blocks that are always available for calling in Python programs.
 Built-in Functionsabs()to return the absolute value of a numberall()to returnTrueif all elements of the iterable are true (or if the iterable is empty).any()to returnTrueif any element of the iterable is true. ReturnFalse, if the iterable is emptyascii()to return a string containing a printable representation of an object, but escape the non-ASCII characters in the string returned byrepr()using\x,\u, or\Ubin()to convert an integer number to a binary string prefixed with "0b"
classbool()to return a Boolean value,TrueorFalsebreakpoint()to drop into the debuggerbytearray()to return a new array of bytesbytes()to return a new bytes objectcallable()to return aTrueif the object argument appears callable,Falseif notchr()to return the string of a Unicode code pointclassmethod()to transform a method into a class methodcompile()to compile the source into a code or AST objectcomplex()to return a complex number with the valuereal+imag*1j or convert a string or number to a complex numberdelattr()to delete the named attribute, provided the object allows itdict()to create a new dictionarydir()to return the list of names in the current local scope, or a list of valid attributes for specified object.divmod()to return a pair of numbers consisting of their quotient and remainder when using integer division by taking two non complex numbers as arguments.enumerate()to return an enumerate objecteval()to return the result of the evaluated expressionexec()to execute the given Python codefilter()to construct an iterator from those elements ofiterablefor which function returns truefloat()to return a floating point number constructed from a number or stringformat()to convert a value to a formatted representationfrozenset()to return a newfrozensetobjectgetattr()to return the value of the named attribute of objectglobals()to return a dictionary representing the current global symbol tablehasattr()to returnTrueif the object has the specified attributehash()to return the hash value of the objecthelp()to invoke the built-in help systemhex()to convert an integer number to a lowercase hexadecimal string prefixed with "0x"id()to return the identity of an objectinput()to read a line from inputint()to return an integer objectisinstance()to returnTrueif the object argument is an instance of theclassinfoargument or of a subclass thereofissubclass()to returnTrueif class is a subclassiter()to return aniteratorobjectlen()to return the length or the item number of an objectlist()to return alistobjectlocals()to update and return a dictionary representing the current local symbol tablemap()to return an iterator that applies functio to every item of iterable, yielding the resultsmax()to return the largest item in an iterable or argumentsmemoryview()to return a memory view object created from the given argumentmin()to return the smallest item in an iterable or argumentsnext()to retrieve the next item from the iterator by calling its__next__()methodobject()to return a new featureless object.oct()to convert an integer number to an octal string prefixed with "0o"open()to open file and return a correspondingfileobjectord()to return an integer representing the Unicode code pointpow()to return base to the power expprint()to print objects to the text stream fileproperty()to return a property attributerange()to return a rangerepr()to return a string containing a printable representation of an objectreversed()to return a reverseiteratorround()to return number rounded to ndigits precision after the decimal pointset()to return a newsetobjectsetattr()to assign the value to the attribute, provided the object allows itslice()to return asliceobject representing the set of indices specified byrangesorted()to return a new sorted list from the items in iterablestaticmethod()to transform a method into a static methodstr()to return astrversion of objectsum()to return the total of iterable from left to rightsuper()to return a proxy object that delegates method calls to a parent or sibling class of type.tuple()to return atupletype()to return the type of an objectvars()to return the__dict__attribute for a module, class, instance, or any othe object with a__dict__attributezip()to return an iterator of tuples, where the i-th tuple contains the i-th element from each of the argument sequence or iterables.__import__()to import the module name, potentially using the given globals and locals to determine how to interpret the name in a package contextSource and Reference©sideway
 
 ID: 200601502 Last Updated: 6/15/2020 Revision: 0 |  |