Daily Software Tips & Tricks
Bite-sized knowledge to improve your coding skills daily.
Quick and Dirty Python Debugging with the f-string '=' Shortcut
May 27, 2026
We've all been there: sprinkling 'print()' statements all over our Python code to figure out why a variable isn't what we expect. Instead of typing 'print(f"user_id: {user_id}")', save yourself some keystrokes by using the '=' shortcut inside your f-string. Simply write 'print(f"{user_id=}")'.
Python will automatically expand this to print both the variable name and its evaluated value, outputting 'user_id=42'. It even works for expressions, like 'print(f"{len(users)=}")'. It's a small, built-in trick that makes quick print-debugging much faster and cleaner.