# finally

*noun*

say it: **“FY-nuh-lee”** **/ˈfaɪnəli/**

In Python, the block after try and except that runs no matter what happened, which makes it the place for clean-up.

## What does `finally` do?

`finally` runs after `try` and `except` no matter what happened, which makes it the place for clean-up.

```python
try:
    print("Charging card...")
    raise ConnectionError("network down")
except ConnectionError:
    print("Payment failed")
finally:
    print("Closing payment screen")   # always runs
```

## In a sentence

- “The **finally** block closes the payment screen whether the charge worked or not.”
- “Code in **finally** runs even when the except block raises again.”

Level: Journeyman · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/finally
