How do I center my text in python? I have a title and a description, and wan't to center it all in my output.

Recommended Answers

All 2 Replies

Use something like that ...

s = "My Title"
width = 70
s = s.center(width)

print( s )

How do I center my text in python? I have a title and a description, and wan't to center it all in my output.

GUI or Console?
If GUI which one? In wxPython, wx.ALIGN_CENTER would do the Job

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.