Justifying and aligning text in Python

If you need some alignment in the text you output from your program, than you can use the ‘ljust’, ‘rjust’ and ‘center’ string methods to accomplish that.

All the above methods accept a second parameter which allows you to fill the gap in the output with a character.

You can test your Python code using the online code editor.

Leave a Reply

Your email address will not be published. Required fields are marked *