-
-
Save IndhumathyChelliah/42adb75456b149deea8f8a19c684280e 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="Hello World!" | |
print(s1.zfill(20))#Output:00000000Hello World! | |
#width mentioned is less than len(s1) | |
print (s1.zfill(12))#Output:Hello World! | |
#signed prefix | |
s2="-12" | |
print (s2.zfill(10))#Output:-000000012 | |
print (s2.zfill(2))#Output:-12 | |
s3="+12" | |
print (s3.zfill(10))#Output:+000000012 | |
print (s3.zfill(2))#Output:+12+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment