r/ProgrammerHumor • • Aug 26 '20

Python goes brrrr

Post image
59.2k Upvotes

789 comments sorted by

View all comments

Show parent comments

42

u/Moldy_pirate Aug 26 '20

Is there ever a reason to use a “regular” string rather than an f”string?

0

u/[deleted] Aug 26 '20

[deleted]

19

u/Sir_Bucket Aug 26 '20

Yes you can, you need to double them:

print(f”open: {{ close: }}”)

Result:

open: { close: }

6

u/Terrain2 Aug 26 '20

And it’s the exact same thing in C#, but they’re $strings

System.Console.WriteLine($"open: {{ close: }}");

same result

→ More replies (4)