Daily Software Tips & Tricks

Bite-sized knowledge to improve your coding skills daily.

The Power of F-String Debugging

March 1, 2026

If you’re still using print("var =", var) to debug your Python code, there's a much cleaner way. Since Python 3.8, you can use the equals sign inside an f-string to print both the expression and its value. Just write print(f"{my_variable=}") and Python will automatically output the name and the value for you.

It saves a ton of repetitive typing and keeps your console output organized without any extra effort. It even works with expressions, like print(f"{user.name.upper()=}"), making it a powerful tool for quick sanity checks during development.