center()

center(length,filling_char)
length: required , the length of the string after adding filling_char at both sides.
filling_char : (optional), default is blank space, used at both sides of the string.

my_str="plus2net.com"
print(my_str.center(30))
Output is here ( there are blank spaces at both sides of the string. Total length of the output string is equal to 30)
         plus2net.com         

With filling_char

my_str="plus2net.com"
print(my_str.center(30,'*'))
Output
*********plus2net.com*********


All String methods



plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer