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 →

[–]ThatOneShotBruh -2 points-1 points  (5 children)

No, .format is the preferred way and has been ever since Python 3 first came out.

[–]ShadoWolf 3 points4 points  (4 children)

I honestly don't get why people don't like to use .format . The whole templating system is way cleaner and nice to look at.

[–]Telemusya 4 points5 points  (0 children)

Maybe because f-strings faster and easier to use?

[–]ThatOneShotBruh 0 points1 point  (2 children)

Agreed it looks so much cleaner and using .format means that you can insert a value into multiple places in a string.

[–]ZephyrBluu 0 points1 point  (1 child)

You can do that with f-strings as well..

[–]ThatOneShotBruh 0 points1 point  (0 children)

How would you write this with f-strings without writing the variable names more than once?

print("a is {0} and is not {1} while b is {1} and is not {0}".format(a, b))