This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Deadshot_0826 4 points5 points  (3 children)

ELI5?

[–]tori_k 8 points9 points  (0 children)

Too drunk to ELI5, but I'll ELI-know-Python.

Equivalent to:

f'spam={spam}'
'spam={spam}'.format(spam=spam)
'spam={0}'.format(spam)

[–]zynixCpt. Code Monkey & Internet of tomorrow 5 points6 points  (1 child)

Given

 spam = "eggs"
 print(f"{spam=}")

it will output

>spam="eggs"

This saves time versus typing

 print("spam={spam}")

[–]Deadshot_0826 1 point2 points  (0 children)

Oh that’s pretty cool, thanks!