Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python pad with spaces

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

# custom formatting
>>> f'{"hi":<10}'
'hi        '
Comment

Python - How To Pad String With Spaces

a = "I am legend" print(a.ljust(15))
Comment

PREVIOUS NEXT
Code Example
Python :: convert column series to datetime in pandas dataframe 
Python :: concatenate int to string python 
Python :: copy list python 
Python :: drawing arrows in tkinter 
Python :: from django.contrib import messages 
Python :: models. type for phone number in django 
Python :: correlation between images python 
Python :: pil img to pdf 
Python :: pyspark group by and average in dataframes 
Python :: selenium firefox webdriver 
Python :: python create function 
Python :: combine dataframes with two matching columns 
Python :: drop list of columns pandas 
Python :: flask client ip 
Python :: box plot seaborn python 
Python :: url settings 
Python :: def function python 
Python :: python program to add two numbers using function 
Python :: solve ax=b python 
Python :: selenium if statement python 
Python :: how to close a flask web server with python 
Python :: python count array length 
Python :: hot to check tkinter verionin python 
Python :: how yo import python lib 
Python :: split a string with 2 char each in python 
Python :: python 3 custom sort with compare 
Python :: one line if statement without else 
Python :: run django localhost server 
Python :: change color of text button pyqt5 
Python :: redirect parameters flask 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =