Python f-string debugging: Printing expressions with =

Python f-string debugging: Printing expressions with =

Want to print a Python expression and its value?

x = 5
y = 'abcd'
print(f'x = {x}, y = {y}')

The modern way:

print(f'{x=}, {y=}')

All expressions work:

print(f'{x*2=}')
print(f'{x**3=}')
print(f'{len(y)=}')
print(f'{list(y)=}')