Table of Content
Let's find out how to debugging with f-strings today. You may already know that '{n}' can be replaced by the '.format(*args)' like this:
1 2 3 4 5 6 |
foo = 2 bar = 3 print("foo={0}, bar={1}".format(foo, bar)) #output: # foo=2, bar=3 |
with f-strings, you can also change to this:
1 2 3 4 |
print(f'foo={foo}, bar={bar}') #output: # foo=2, bar=3 |
Both of them are fine, but I prefer to f-strings, it's my style.