I want to fill an entire line in the screen with *
characters and stop just before break line?
Something like this
********** MENU **********
Thanks
I want to fill an entire line in the screen with *
characters and stop just before break line?
Something like this
********** MENU **********
Thanks
>>> print(' MENU '.center(80, '*'))
************************************* MENU *************************************
Note that 80 is not the actual width of the screen. It's just an arbitrary number I choose because it's the usual size of the console window on Windows. If you want to determine the actual screen width you can try these examples for Linux and Windows.
You can also do this with format strings
In [32]: '{0:*^80}'.format('MENU')
Out[32]: '**************************************MENU**************************************'
This says use the '*'
character to pad 'MENU'
to 80 characters in the center. The '^'
character indicates center.