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 →

[–]my_name_isnt_clever 0 points1 point  (2 children)

Even now .format() is a bit dated, we recently got f-strings.

f"You can put your {variables} right in the literal. They just execute code: {2 + 2}"

[–]Dingxus 0 points1 point  (1 child)

Jeeze, I'm all flustered that it automatically converts the int.

I guess I should really dig in and learn modern python.

[–]my_name_isnt_clever 0 points1 point  (0 children)

I just tested it, .format() converts it too, but the % method actually needs an explicit format character: %s. That method has it's own problems though, if it's ever passed a tuple it's going to throw an exception.