#python

Found 36 articles tagged with #python

How to run shell commands in Python

Python can be used to automate various tasks, and sometimes these tasks involve interacting with the underlying operating system.

Dec 17, 2023#python#shells

Check if a variable is list in Python

This verification is essential for ensuring that the subsequent operations or functions are appropriate for the data structure at hand.

Dec 16, 2023#python#lists

How to use tuple type hints in Python

Python 3.8 and earlier require importing `Tuple` from the `typing` module. Python 3.9+ allows using `tuple` directly without importing.

Dec 12, 2023#python#tuples

How to perform string interpolation in Python

You can use the % operator, format method, or f-strings to perform string interpolation, which is inserting values into a string in Python.

Dec 08, 2023#python#strings

Local variable referenced before assignment in Python

This is a common error in Python that occurs when you try to use a variable that has not been assigned a value in the local scope of a function.

Aug 20, 2023#python

How to check if string contains substring in Python

A substring is a contiguous sequence of characters within a string. Python provides several ways to check for substrings within a larger string.

Jul 29, 2023#python#strings