''' this code is use for padding a string ''' data="Life is very easy with Python" ''' padding from left ''' print data.ljust(35,'#') ''' padding from right ''' print data.rjust(35,'#') ''' padding from both sides ''' print data.center(35,'#')
Output:
Life is very easy with Python###### ######Life is very easy with Python ###Life is very easy with Python###
0 comments:
Post a Comment