center()

All String methods
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

Subscribe to our YouTube Channel here

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





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