Copyright © tutorialspoint.com
This method returns centered in a string of length width. Padding is done using the specified fillchar. Default filler is a space.
str.center(width[, fillchar]) |
Here is the detail of parameters:
width: is the total width of the string.
fillchar: is the filler character.
It returns centered in a string of length width.
#!/usr/bin/python str = "this is string example....wow!!!"; print "str.center(40, 'a') : ", str.center(40, 'a') |
This will produce following result:
str.center(40, 'a') : aaaathis is string example....wow!!!aaaa |
Copyright © tutorialspoint.com