Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
The Hidden Debugging Shortcut in Python F-Strings
May 22, 2026
We've all written quick print statements like `print(f"user_id: {user_id}")` to debug our Python code. But there is a much cleaner, built-in shortcut that saves you from typing out the variable name twice. If you add an equal sign `=` inside the curly braces after the variable name, Python will automatically print both the expression and its evaluated value.
For example, `print(f"{user_id=}")` will output `user_id=42`. It even preserves whitespace and works with expressions, like `f"{len(users)=}"`. It’s a tiny syntax trick that makes quick-and-dirty debugging incredibly satisfying.