Python f-strings for filenames and URLs

Remember, #Python f-strings are strings: 1. Use f-strings anywhere you'd use strings, e.g., filenames and URLs 2. You don't have to print an f-string; you can store it. 3. Don't overuse them! I see people writing print(f'{x}') when they can say print(x)

  • No alternative text description for this image

The "don't overuse them" part is the real lesson. Every beginner does it.

Like
Reply

Important – fstrings get interpolated when you write them. So if you change `x` later, `response` doesn't change!

See more comments

To view or add a comment, sign in

Explore content categories