DEV Community

qing
qing

Posted on

TIL: f-strings support `=` for quick debugging in Python 3.8+ (2026)

TIL: f-strings support = for quick debugging in Python 3.8+
As of Python 3.8, f-strings have become even more powerful with the addition of the = operator for quick debugging. This feature allows you to print both the name and value of a variable in a single line of code.

Before:

variable = 10
print(f"variable: {variable}")
Enter fullscreen mode Exit fullscreen mode

This would output: variable: 10

After:

variable = 10
print(f"{variable=}")
Enter fullscreen mode Exit fullscreen mode

This would output: variable=10

As you can see, using f"{variable=}" is a more concise and readable way


Follow me on Dev.to for daily Python tips and quick guides!


💡 Related: **Content Creator Ultimate Bundle (Save 33%)* — $29.99*


🔗 Recommended Resources

Note: Some links are affiliate links. Using them supports this blog at no extra cost to you.

Top comments (0)