Pooja Pawar
• len() – Returns the number of items in an object
Syntax: len(object)
• type() – Returns the type of an object
Syntax: type(object)
• str() – Converts an object into a string
Syntax: str(object)
• int() – Converts a value into an integer
Syntax: int(value)
• float() – Converts a value into a floating-point
number
Syntax: float(value)
• list() – Converts an iterable into a list
Syntax: list(iterable)
• tuple() – Converts an iterable into a tuple
Syntax: tuple(iterable)
Pooja Pawar
• set() – Creates a set from an iterable
Syntax: set(iterable)
• dict() – Creates a dictionary from key-value pairs
Syntax: dict(mapping or iterable)
• range() – Generates a sequence of numbers
Syntax: range(start, stop, step)
• sorted() – Returns a sorted list from an iterable
Syntax: sorted(iterable, key=None, reverse=False)
• abs() – Returns the absolute value of a number
Syntax: abs(number)
• round() – Rounds a number to specified decimals
Syntax: round(number, ndigits=None)
• sum() – Returns the sum of values in an iterable
Syntax: sum(iterable, start=0)
Pooja Pawar
• min() – Returns the smallest value in an iterable
Syntax: min(iterable)
• max() – Returns the largest value in an iterable
Syntax: max(iterable)
• enumerate() – Returns index and value pairs
Syntax: enumerate(iterable, start=0)
• zip() – Combines multiple iterables element-wise
Syntax: zip(*iterables)
• any() – Returns True if any element is True
Syntax: any(iterable)
• all() – Returns True if all elements are True
Syntax: all(iterable)
• map() – Applies a function to each item
Syntax: map(function, iterable)
Pooja Pawar
• filter() – Filters elements based on a condition
Syntax: filter(function, iterable)
• open() – Opens a file and returns a file object
Syntax: open(file, mode='r')
• read() – Reads content from a file
Syntax: file.read()
• write() – Writes content to a file
Syntax: file.write(string)
• close() – Closes an open file
Syntax: file.close()
• help() – Displays documentation for an object
Syntax: help(object)
• dir() – Lists attributes and methods of an object
Syntax: dir(object)
Pooja Pawar
• isinstance() – Checks if an object belongs to a
class
Syntax: isinstance(object, classinfo)
• issubclass() – Checks class inheritance
Syntax: issubclass(class, classinfo)
• getattr() – Gets the value of an attribute
Syntax: getattr(object, name, default)
• setattr() – Sets the value of an attribute
Syntax: setattr(object, name, value)
• hasattr() – Checks if an attribute exists
Syntax: hasattr(object, name)
• delattr() – Deletes an attribute
Syntax: delattr(object, name)
• vars() – Returns the __dict__ of an object
Syntax: vars(object)
Pooja Pawar
• globals() – Returns the global symbol table
Syntax: globals()
• locals() – Returns the local symbol table
Syntax: locals()
• callable() – Checks if an object is callable
Syntax: callable(object)
• format() – Formats a value into a string
Syntax: format(value, format_spec)
• repr() – Returns official string representation
Syntax: repr(object)
• ascii() – Returns ASCII-only representation
Syntax: ascii(object)
• id() – Returns the unique identity of an object
Syntax: id(object)
Pooja Pawar
• chr() – Converts an integer to a character
Syntax: chr(i)
• ord() – Converts a character to its Unicode value
Syntax: ord(c)
• bin() – Converts a number to binary format
Syntax: bin(number)
• oct() – Converts a number to octal format
Syntax: oct(number)
• hex() – Converts a number to hexadecimal
format
Syntax: hex(number)
• hash() – Returns the hash value of an object
Syntax: hash(object)
• slice() – Creates a slice object
Syntax: slice(start, stop, step)
Pooja Pawar
• memoryview() – Accesses memory without
copying
Syntax: memoryview(object)
• compile() – Compiles source code
Syntax: compile(source, filename, mode)
• exec() – Executes dynamically created code
Syntax: exec(object)
• breakpoint() – Starts the debugger
Syntax: breakpoint()
• super() – Accesses parent class methods
Syntax: super()
• property() – Manages attribute access
Syntax: property(fget, fset, fdel, doc)
• staticmethod() – Defines a static method
Syntax: @staticmethod
Pooja Pawar
• classmethod() – Defines a class method
Syntax: @classmethod
• input() – Reads user input from console
Syntax: input(prompt)
• print() – Prints output to console
Syntax: print(objects)
• next() – Returns the next item from an iterator
Syntax: next(iterator)
• iter() – Returns an iterator object
Syntax: iter(iterable)
• frozenset() – Creates an immutable set
Syntax: frozenset(iterable)
• bool() – Converts a value to Boolean
Syntax: bool(value)
Pooja Pawar
• bytes() – Creates an immutable bytes object
Syntax: bytes(source, encoding, errors)
• bytearray() – Creates a mutable bytes object
Syntax: bytearray(source, encoding, errors)
• object() – Creates a base object
Syntax: object()
• complex() – Creates a complex number
Syntax: complex(real, imag)
• pow() – Returns a number raised to a power
Syntax: pow(base, exp, mod=None)
• divmod() – Returns quotient and remainder
Syntax: divmod(a, b)
• reversed() – Returns a reverse iterator from an
iterable
Syntax: reversed(iterable)
Pooja Pawar
• append() – Adds an item to the end of a list
Syntax: list.append(item)
• extend() – Adds multiple items to a list
Syntax: list.extend(iterable)
• insert() – Inserts an item at a given position
Syntax: list.insert(index, item)
• remove() – Removes the first matching item
Syntax: list.remove(value)
• pop() – Removes and returns an item by index
Syntax: list.pop(index=-1)
• get() – Returns a value for a key (safe access)
Syntax: dict.get(key, default=None)
• update() – Updates a dictionary with key-value
pairs
Syntax: dict.update(mapping)
Pooja Pawar
• assert – Tests a condition during debugging
Syntax: assert condition
• pass – Acts as a placeholder statement
Syntax: pass
• yield – Produces a value from a generator
Syntax: yield value
• raise – Raises an exception
Syntax: raise Exception
• try – Wraps risky code
Syntax: try:
• except – Handles exceptions
Syntax: except Exception:
• finally – Executes cleanup code
Syntax: finally:
Pooja Pawar
• format_map() – Formats a string using a mapping
Syntax: str.format_map(mapping)
• capitalize() – Capitalizes the first character
Syntax: str.capitalize()
• casefold() – Converts string for case-insensitive
comparison
Syntax: str.casefold()
• center() – Centers a string with padding
Syntax: str.center(width)
• count() – Counts occurrences of a substring
Syntax: str.count(substring)
• endswith() – Checks string ending
Syntax: str.endswith(suffix)
• startswith() – Checks string beginning
Syntax: str.startswith(prefix)
Pooja Pawar
• find() – Finds first occurrence index
Syntax: str.find(substring)
• index() – Finds index or raises error
Syntax: str.index(substring)
• isalnum() – Checks alphanumeric
Syntax: str.isalnum()
• isalpha() – Checks alphabetic
Syntax: str.isalpha()
• isdigit() – Checks numeric
Syntax: str.isdigit()
• islower() – Checks lowercase
Syntax: str.islower()
• isupper() – Checks uppercase
Syntax: str.isupper()
Pooja Pawar
• join() – Joins iterable into a string
Syntax: str.join(iterable)
• lstrip() – Removes leading spaces
Syntax: str.lstrip()
• rstrip() – Removes trailing spaces
Syntax: str.rstrip()
• strip() – Removes both-side spaces
Syntax: str.strip()
• replace() – Replaces substring
Syntax: str.replace(old, new)
• split() – Splits string into list
Syntax: str.split(separator)
• rsplit() – Splits string from right
Syntax: str.rsplit(separator)
Pooja Pawar
Follow for more
data analytics
content
Pooja Pawar