python 字符框


1 #!/usr/bin/env python
2 #coding:utf8
3 width = 48
4 data = []
5 while True:
6 entry = raw_input("输入数据q退出")
7 if entry == 'q':
8 break
9 else:
10 data.append(entry)
11 print '+' + '*' * width + '+'
12 for item in data:
13 #length,extra = divmod((48 - len(item)),2)
14 print "+" +item.center(width)+ "+"
15
16 print '+' + '*' * width + '+'
~
~

posted @ 2017-10-30 17:44  jack-toy  阅读(245)  评论(0编辑  收藏  举报