Sorry if this has been asked before, I have looked but I can't find the answer I want. I'm creating a card class for a game and I have this for the str definition:
def __str__(self):
return self.rank + " of " + self.suit
Which works, but is printing the cards like this,
Two of Hearts
Three of Hearts
Four of Hearts
Five of Hearts
I have seen a method for printing extra space into a string and I want it to print it with a couple of extra spaces so that the "of rank" parts of the string all line up. Unfortunately I can't remember what the method is, nor what it's called, so I'm having difficulty finding it again.
Also bonus question, I'm having difficulty demonstrating what I mean on Stack Overflow because it doesn't seem to want to let me place lines of text directly underneath other lines of text without making it a whole new paragraph, and additionally doesn't let me add extra spaces between words. I get that this is probably to help with question formatting and making sure they don't take up too much space with junk, but it makes demonstrating what I mean difficult, is there any way to get around that?