I am creating a simple console-based Python (version 2.4) script that will be run on a Bash shell. It is a simple menu-based script that displays a set of options to the user and will do specific tasks depending on the user input.
When the script starts, I want it to clear the screen and display the menu in the center of the screen. I can get the console width from stty size
. How do I go about center-aligning the text?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…