-
-
Save IndhumathyChelliah/5c37c493e08fece36ef3fe7593e8d610 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s1="HelloWorld!" | |
print (s1.rjust(20,"*"))#Output:*********HelloWorld! | |
print (s1.ljust(20,"*"))#Output:HelloWorld!********* | |
print (s1.center(20,'*'))#Output:****HelloWorld!***** | |
#original string is returned,since width(10) specified is less than len(s1) | |
print (s1.center(10,'*'))#Output:HelloWorld! | |
print (s1.rjust(10,"*"))#Output:HelloWorld! | |
print (s1.ljust(10,"*"))#Output:HelloWorld! | |
#fillchar is not mentioned. default fillchar is an ASCII space | |
print(s1.center(30))#Output: HelloWorld! | |
print(s1.rjust(30))#Output: HelloWorld! | |
print (s1.ljust(30))#Output:HelloWorld! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment