Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

py variable space padding

mystr = "peter"
width = 10
filler = '*'

print(f'Output: {mystr:{filler}<{width}}')
# -> 'Output: peter*****'

print(f'Output: {mystr:{filler}>{width}}')
# -> 'Output: *****peter'
Source by www.peterbe.com #
 
PREVIOUS NEXT
Tagged: #py #variable #space #padding
ADD COMMENT
Topic
Name
8+3 =