Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
Is there a custom way of padding lines of text in python, I am using the escape characters "\t", but I wonder if there is an alternative. for example
print('My Name is:') print('Rambo') print('Mambo')
Output:
.My Name is: .....Rambo ..Mambo
print()
Try using:
print('{:>15}'.format('My Name is:'))
Refer for examples: PyFormat
Add a comment
Write a simple function for yourself.
def p(a,b): print(" "*a + b) p(1,"while")
This should return:" while"
" while"
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
print()and format as you like