Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
The Easiest Way to Debug Python with F-Strings
May 21, 2026
We've all used print statements to debug our Python code, but writing `print(f"user_id = {user_id}")` over and over gets old fast. Python 3.8 introduced a tiny shortcut that makes this effortless: the `=` sign inside f-strings.
Instead of writing out the variable name twice, just write `print(f"{user_id=}")`. Python will automatically expand this to print both the variable name and its value (e.g., `user_id=42`). It also works with expressions and function calls, making quick-and-dirty terminal debugging much cleaner and faster.