Most Commonly Used
These functions are used in almost every Python program:print()
Output text to the console.any
Values to print (converted to strings)
str
default:"' '"
String inserted between values
str
default:"'\\n'"
String appended after the last value
file
default:"sys.stdout"
File object to write to
len()
Return the length of an object.object
required
Any object with a length (string, list, dict, etc.)
int
Number of items in the object
type()
Return the type of an object.any
required
Object to get the type of
type
The type of the object
range()
Generate a sequence of numbers.int
required
End of range (exclusive)
int
default:"0"
Start of range (inclusive)
int
default:"1"
Increment between values
input()
Read a string from standard input.str
default:"''"
Prompt to display before reading input
str
String entered by the user
Type Conversion
Convert between different data types:int(), float(), str(), bool()
list(), tuple(), set(), dict()
Iteration & Sequences
enumerate()
Add counter to an iterable.zip()
Combine multiple iterables.map()
Apply function to every item.filter()
Filter items based on condition.sorted()
Return sorted list.reversed()
Reverse an iterable.Mathematical Functions
sum(), min(), max()
abs(), round(), pow()
divmod()
Get quotient and remainder.Object Inspection
isinstance()
Check if object is instance of class.hasattr(), getattr(), setattr()
Work with object attributes.dir()
List attributes of an object.vars()
Return__dict__ attribute of an object.
File Operations
open()
Open a file for reading or writing.str
required
Path to the file
str
default:"'r'"
Opening mode: ‘r’ (read), ‘w’ (write), ‘a’ (append), ‘b’ (binary)
str
default:"None"
Text encoding (e.g., ‘utf-8’)
Advanced Functions
all(), any()
Test if all or any elements are true.eval(), exec()
compile()
Compile source code into code object.globals(), locals()
Access global and local namespaces.Special Functions
id()
Return unique identifier for an object.hash()
Return hash value of an object.callable()
Check if object is callable.Complete List
Here are all 71 built-in functions:Complete Alphabetical List
Complete Alphabetical List
abs()- Absolute valueaiter()- Async iteratorall()- Test if all elements are trueanext()- Async nextany()- Test if any element is trueascii()- ASCII representationbin()- Convert to binarybool()- Convert to booleanbreakpoint()- Debugger breakpointbytearray()- Mutable bytesbytes()- Immutable bytescallable()- Check if callablechr()- Character from code pointclassmethod()- Class method decoratorcompile()- Compile source codecomplex()- Complex numberdelattr()- Delete attributedict()- Dictionarydir()- List attributesdivmod()- Quotient and remainderenumerate()- Add counter to iterableeval()- Evaluate expressionexec()- Execute codefilter()- Filter itemsfloat()- Convert to floatformat()- Format valuefrozenset()- Immutable setgetattr()- Get attributeglobals()- Global namespacehasattr()- Check for attributehash()- Hash valuehelp()- Interactive helphex()- Convert to hexadecimalid()- Object identifierinput()- Read inputint()- Convert to integerisinstance()- Check instanceissubclass()- Check subclassiter()- Create iteratorlen()- Length of objectlist()- Listlocals()- Local namespacemap()- Map functionmax()- Maximum valuememoryview()- Memory viewmin()- Minimum valuenext()- Next item from iteratorobject()- Base objectoct()- Convert to octalopen()- Open fileord()- Code point from characterpow()- Powerprint()- Print outputproperty()- Property decoratorrange()- Range of numbersrepr()- String representationreversed()- Reverse iterableround()- Round numberset()- Setsetattr()- Set attributeslice()- Slice objectsorted()- Sort iterablestaticmethod()- Static method decoratorstr()- Stringsum()- Sum of itemssuper()- Call parent classtuple()- Tupletype()- Type of objectvars()- Object dictionaryzip()- Combine iterables__import__()- Import module
Best Practices
Related
Built-in Types
Fundamental data types
itertools
Advanced iteration tools
functools
Higher-order function tools
