Answers for "python pad with spaces"

0

python pad with spaces

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

# custom formatting
>>> f'{"hi":<10}'
'hi        '
Posted by: Guest on August-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language