-
연속된 문자열 처리Python 2014. 5. 7. 23:32
"x"*10 -à "xxxxxxxxxx"
"xyz"*2 --? "xyzxyz"
sentence = input("enter sentence : ")
screen_width = 80
text_width = len(sentence)
box_width = text_width + 6;
left_margin = screen_width//2 - box_width//2
print()
print(" "*left_margin+"+"+"-"*(box_width)+"+")
print(" "*left_margin+"|"+" "*(box_width)+"|")
print(" "*left_margin+"|"+" "*3+sentence+" "*3+"|")
print(" "*left_margin+"|"+" "*(box_width)+"|")
print(" "*left_margin+"+"+"-"*(box_width)+"+")
+----------------------+
| |
| Welcome to Korea |
| |
+----------------------+
'Python' 카테고리의 다른 글
String Formatting (0) 2014.05.11 String short version & Template (0) 2014.05.10 Tuple (0) 2014.05.09 List & List member function (0) 2014.05.09 Slicing (0) 2014.05.07