Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python string formatting - padding

# string padding with left alignment
print("{:5}".format("cat"))

# string padding with right alignment
print("{:>5}".format("cat"))

# string padding with center alignment
print("{:^5}".format("cat"))

# string padding with center alignment
# and '*' padding character
print("{:*^5}".format("cat"))
Comment

PREVIOUS NEXT
Code Example
Python :: how to make a static variable in python 
Python :: how to check whether input is string or not 
Python :: binary tree python 
Python :: size pilimage 
Python :: with function python 
Python :: python - sending mail 
Python :: how to find out the max and min date on the basis of property id in pandas 
Python :: Query a PSQL Database From Python 
Python :: how to take first half of list python 
Python :: how to add some thing in python list 
Python :: convert string to float python 
Python :: python collection 
Python :: python game github 
Python :: python background process 
Python :: how to take an input in python 
Python :: element tree directory python 
Python :: how to parse http request in python 
Python :: df to dict 
Python :: python projects 
Python :: hwo to except every error in python try statemen 
Python :: python set workspace dir 
Python :: how to delete item in string python 
Python :: pass python 
Python :: django 3 create async rest api 
Python :: python list include 
Python :: model coefficients 
Python :: how to exit a loop in python 
Python :: how to plot a pandas dataframe with matplotlib 
Python :: reshape IML matrix 
Python :: python remove first item in list 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =