You are viewing a single comment's thread. Return to all comments →
Consider the example "john".rjust(5)
This doesnt actually give 5 spaces to the string.
Consider the given string as a block [j][o][h][n](i.e there are four blocks)
As we have given width=5 and the given string is of 4 blocks ,it just adds one more block(i.e,the empty block which is a space) to make it equal to 5. [j][o][h][n]
So now it becomes " john".Make note of the space before the string.
If you specify any char,the space then gets filled with the given char.