Python

Introduction

This page is dedicated to collect a set of thinks that I learn during my develop experience

First of all, a list of my blog post with Python topic:

Tools

Suppress

Suppress is a context manager that suppresses specified exceptions. It is useful when you want to ignore certain exceptions without having to write try-except blocks.

from contextlib import suppress
import os

# Suppress the FileNotFoundError if the file does not exist
with suppress(FileNotFoundError):
  os.remove("file_not_present")