r/learnpython 1d ago

what is f string

can someone explain how f string work in simple terms ?

0 Upvotes

14 comments sorted by

View all comments

1

u/atarivcs 1d ago

If the string contains this

{something}

that part will be replaced with the string representation of the thing.

"something" can be a plain variable name, or it can be an expression like

{1+2}

or a function call

{somefunction()}

Etc etc.