You are here : python_2stringstringcenter - string


The method center() returns centered in a string of length width. Padding is done using the specified fillchar. Default filler is a space.

  • width -- This is the total width of the string.

  • fillchar -- This is the filler character.

Syntax[, fillchar])



str = "this is string!!!";

print ", 'a') : ",, 'a')

Output / Return Value

The following example shows the usage of center() method., 'a') : aaaathis is string!!!aaaa


Alternatives / See Also