Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python pad with spaces

# str.ljust(width[, fillchar])
>>> 'hi'.ljust(10)
'hi        '
>>> 'hello'.ljust(10, '-')
'hello-----'

# custom formatting
>>> f'{"hi":<10}'
'hi        '
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #pad #spaces
ADD COMMENT
Topic
Name
7+2 =