How to in Python articles

How to delete files and directories in Python

How to delete files and directories in Python using os and shutils modules

Read more

How to get and change the working directory in Python

What is a working directory (CWD), and how to get it and change it in Python?

Read more

How to read directory content in Python

We look at three ways to read directory content using the built-in os module.

Read more

How to filter a list in Python

There are many ways to filter a list in Python. What are they and which one is the best?

Read more

How to get the first matching item in a list without a loop in Python

Can we avoid a loop and keep its efficiency when we want to get the first matching item in the list?

Read more

How to flat a list of lists in Python

What is the best way to flat a list of lists?

Read more

How to merge dictionaries in Python

What is the best way to merge two or more dictionaries into one?

Read more

How to create a list of unique items with a comprehension in Python

List comprehensions are a fantastic tool to work with lists. Is it possible to create a list of unique items with list comprehension?

Read more

When to make a new .py file for a Python project?

Learn when to make a new .py file for a Python project and how to split and organize code.

Read more

Join the newsletter

Subscribe to get new articles about Python, code and programming into your inbox!