Create a box with text in center
问题 I want to draw a box around my message. The result to be like this: # # # # # # # # # # # # # # # # # # # # # # # # # # # # Message # # # # # # # # # # # # # # # # # # # # # # # # # # # # The box must be resized if the message is longer or shorter. I tried a method, but I can't figure it out to solve it further. total_rows = 5 total_cols = 25 Matrix = [[' ' for x in range(total_cols)] for y in range(total_rows)] def LBoder(): for i in range(total_rows): Matrix[i][0] = '#' def TBorder(): for i