发布时间:2019-09-18 07:27:56编辑:auto阅读(2984)
把字体显示在屏幕的中间
sentence = raw_input("Sentence:")
screen_width = 80text_width = len(sentence)box_width = text_width + 6left_margin = (screen_width - box_width) // 2
printprint ' '*left_margin + '+' + '-'*(box_width) + '+'print ' '*(left_margin+2) + '| ' + ' '*text_width + ' |'print ' '*(left_margin+2) + '| ' + sentence + ' |'print ' '*(left_margin+2) + '| ' + ' '*text_width + ' |'print ' '*left_margin + '+' + '-'*(box_width) + '+'简单地定义了屏幕的宽度,没有去取实际值,后面在更新
上一篇: python 初次使用twisted
下一篇: Python的弱引用
51726
51384
41817
38586
33067
30075
28746
23744
23652
22022
2248°
2935°
2451°
2392°
2979°
2399°
3203°
5266°
5091°
3629°