0

I was following a tutorial and found this.

print(f"{self.name}: {card!r:<3}  ", end="")

And I have no idea what the !r:<3 means. Google wouldn't give me relevant results because of all the symbols.

Tahini245
  • 13
  • 1
  • 4

1 Answers1

1

You can find a description of the format of f-strings here and of the formatting language here.

!r:<3 uses repr to format the value, left aligned with a minimum width of 3 (padded with spaces by default).

Kemp
  • 3,467
  • 1
  • 18
  • 27