Last Updated on November 18, 2025 by Admin
| Index | Modules | Description | Example |
|---|---|---|---|
| 1 | abs() | Returns the absolute value of a number. | print(abs(-7)) # 7 |
| 2 | aiter() | Returns an asynchronous iterator for an async iterable. | import asyncio; aiter_obj = aiter(asyncio.as_completed([asyncio.sleep(1)])) |
| 3 | all() | Returns True if all items in the iterable are truthy. | print(all([True, 1, “non-empty”])) # True |
| 4 | anext() | Gets the next item from an async iterator. | import asyncio; async def gen(): yield 1; print(asyncio.run(anext(gen().__aiter__()))) |
| 5 | any() | Returns True if any item in the iterable is truthy. | print(any([0, False, 5])) # True |
| 6 | ascii() | Returns a printable ASCII-only representation of an object. | print(ascii(“café”)) # ‘caf\u00e9’ |
| 7 | bin() | Converts an integer to a binary string (0b…). | print(bin(10)) # ‘0b1010’ |
| 8 | bool() | Converts a value to True or False. | print(bool(“”)) # False |
| 9 | breakpoint() | Enters the debugger at the current program point. | # breakpoint() # Starts debugger here (commented out to avoid pausing) |
| 10 | bytearray() | Creates a mutable sequence of bytes. | print(bytearray(b”abc”)) # bytearray(b’abc’) |
| 11 | bytes() | Creates an immutable sequence of bytes. | print(bytes([65, 66, 67])) # b’ABC’ |
| 12 | callable() | Returns True if the object can be called like a function. | print(callable(len)) # True |
| 13 | chr() | Returns the character for a Unicode code point. | print(chr(65)) # ‘A’ |
| 14 | classmethod() | Creates a method that receives the class instead of the instance. | class A: @classmethod def f(cls): return cls.__name__; print(A.f()) |
| 15 | compile() | Compiles Python source into a code object. | code = compile(“print(‘Hi’)”, “ |
| 16 | complex() | Creates a complex number. | print(complex(2, 3)) # (2+3j) |
| 17 | delattr() | Deletes an attribute from an object. | class C: x = 5; c = C(); delattr(c, “x”); print(hasattr(c, “x”)) # False |
| 18 | dict() | Creates a dictionary. | print(dict(a=1, b=2)) # {‘a’: 1, ‘b’: 2} |
| 19 | dir() | Lists attributes of an object, module, or scope. | print(dir([])) # List attributes and methods |
| 20 | divmod() | Returns a // b and a % b as a tuple. | print(divmod(10, 3)) # (3, 1) |
| 21 | enumerate() | Adds counters to an iterable. | print(list(enumerate([“a”, “b”]))) # [(0, ‘a’), (1, ‘b’)] |
| 22 | eval() | Evaluates a string as Python code and returns the result. | print(eval(“1 + 2”)) # 3 |
| 23 | exec() | Executes Python code without returning a value. | exec(“x = 5”); print(x) # 5 |
| 24 | filter() | Keeps items where the function returns True. | print(list(filter(lambda x: x > 2, [1, 3, 5]))) # [3, 5] |
| 25 | float() | Converts a value to a floating-point number. | print(float(“3.14”)) # 3.14 |
| 26 | format() | Applies a formatting specification to a value. | print(format(3.14159, “.2f”)) # ‘3.14’ |
| 27 | frozenset() | Creates an immutable set. | print(frozenset([1, 2, 2, 3])) # frozenset({1, 2, 3}) |
| 28 | getattr() | Returns an attribute from an object. | print(getattr(“abc”, “upper”)()) # ‘ABC’ |
| 29 | globals() | Returns the global variable dictionary. | print(“globals” in globals()) # True |
| 30 | hasattr() | Checks if an object has an attribute. | print(hasattr([1, 2, 3], “append”)) # True |
| 31 | hash() | Returns the hash value of an object. | print(hash(“hello”)) |
| 32 | help() | Displays the built-in help system. | # help(len) # Shows help (commented out to avoid long output) |
| 33 | hex() | Converts an integer to hexadecimal (0x…). | print(hex(255)) # ‘0xff’ |
| 34 | id() | Returns the unique identity (memory address) of an object. | print(id(42)) # Unique object ID |
| 35 | input() | Reads a line of input from the user. | # name = input(“Enter name: “) # Uncomment to read input |
| 36 | int() | Converts a value to an integer. | print(int(“10”)) # 10 |
| 37 | isinstance() | Checks if an object is an instance of a class. | print(isinstance(5, int)) # True |
| 38 | issubclass() | Checks if a class is a subclass of another. | print(issubclass(bool, int)) # True |
| 39 | iter() | Returns an iterator for an iterable object. | it = iter([1, 2]); print(next(it)) # 1 |
| 40 | len() | Returns the length of a container. | print(len(“hello”)) # 5 |
| 41 | list() | Creates a list. | print(list(“abc”)) # [‘a’, ‘b’, ‘c’] |
| 42 | locals() | Returns a dictionary of local variables. | print(“locals” in locals()) # True |
| 43 | map() | Applies a function to each item in an iterable. | print(list(map(str, [1, 2]))) # [‘1’, ‘2’] |
| 44 | max() | Returns the largest item. | print(max([1, 5, 3])) # 5 |
| 45 | memoryview() | Creates a memory view object for byte-level access. | print(memoryview(b”abc”)[1]) # 98 (ASCII of ‘b’) |
| 46 | min() | Returns the smallest item. | print(min([1, 5, 3])) # 1 |
| 47 | next() | Returns the next value from an iterator. | it = iter([1, 2]); print(next(it)) # 1 |
| 48 | object() | Creates a new base object instance. | o = object(); print(type(o)) # |
| 49 | oct() | Converts an integer to octal (0o…). | print(oct(8)) # ‘0o10’ |
| 50 | open() | Opens a file and returns a file object. | with open(__file__) as f: print(f.readline().strip()) # Reads first line this script |
| 51 | ord() | Returns the Unicode code point of a character. | print(ord(“A”)) # 65 |
| 52 | pow() | Computes a ** b (with optional modulo). | print(pow(2, 3)) # 8 |
| 53 | print() | Prints objects to standard output. | print(“Hello, World!”) |
| 54 | property() | Defines a managed attribute in a class. | class C: @property def x(self): return 5; print(C().x) |
| 55 | range() | Creates a sequence of numbers. | print(list(range(3))) # [0, 1, 2] |
| 56 | repr() | Returns the official string representation of an object. | print(repr(“abc”)) # “‘abc'” |
| 57 | reversed() | Returns a reversed iterator for a sequence. | print(list(reversed([1, 2, 3]))) # [3, 2, 1] |
| 58 | round() | Rounds a number to a specified number of digits. | print(round(3.14159, 2)) # 3.14 |
| 59 | set() | Creates a set. | print(set([1, 2, 2, 3])) # {1, 2, 3} |
| 60 | setattr() | Sets an attribute on an object. | class C: pass; c = C(); setattr(c, “x”, 10); print(c.x) |
| 61 | slice(), | Creates a slice object for indexing. | s = slice(1, 4); print([0,1,2,3,4][s]) # [1, 2, 3] |
| 62 | sorted() | Returns a new sorted list. | print(sorted([3, 1, 2])) # [1, 2, 3] |
| 63 | staticmethod() | Creates a method that does not receive self or cls. | class C: @staticmethod def f(): return 5; print(C.f()) |
| 64 | str() | Converts a value to a string. | print(str(123)) # ‘123’ |
| 65 | sum() | Returns the sum of items. | print(sum([1, 2, 3])) # 6 |
| 66 | super() | Provides access to parent class methods. | class A: def f(self): return “A”; class B(A): def f(self): return super().f() + “B”; print(B().f()) |
| 67 | tuple() | Creates a tuple. | print(tuple([1, 2, 3])) # (1, 2, 3) |
| 68 | type() | Returns the type of an object or creates a new type. | print(type(5)) # |
| 69 | vars() | Returns the __dict__ attribute of an object. | class C: def __init__(self): self.x = 5; print(vars(C())) |
| 70 | zip() | Combines items from iterables into tuples. | print(list(zip([1, 2], [‘a’, ‘b’]))) # [(1, ‘a’), (2, ‘b’)] |
| 71 | __import__() | Low-level import used internally by import. | math_mod = __import__(“math”); print(math_mod.sqrt(16)) |