Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python String rjust() Method


previous next AddThis Social Bookmark Button


Description:

This method returns the string right justified in a string of length width. Padding is done using the specified fillchar (default is a space). The original string is returned if width is less than len(s).

Syntax:

str.rjust(width[, fillchar])

Parameters:

Here is the detail of parameters:

  • width: string length in total after padding.

  • fillchar: filler character, default is a space

Return Value:

It returns the string right justified in a string of length width. Padding is done using the specified fillchar (default is a space). The original string is returned if width is less than len(s).

Example:

#!/usr/bin/python

str = "this is string example....wow!!!";

print str.rjust(50, '0');

This will produce following result:

000000000000000000this is string example....wow!!!


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names