본문 바로가기
프로그래밍/python

빅텍스트 출력하기

by 신일석 2020. 8. 21.

클래스로 구현한 빅텍스트입니다.

class BigText:
    T1 = "*"*5
    T2 = "*   *"
    T3 = "{0:>5}".format("*")
    T4 = "{0:<5}".format("*")
    PATT = ((T1, T2, T2, T2, T1), (T3, T3, T3, T3, T3), (T1, T3, T1, T4, T1),
              (T1, T3, T1, T3, T1), (T2, T2, T1, T3, T3), (T1, T4, T1, T3, T1),
              (T1, T4, T1, T2, T1), (T1, T2, T2, T3, T3), (T1, T2, T1, T2, T1),
              (T1, T2, T1, T3, T3))
    def __init__(self, num_id):
        self.num_id = num_id
    def show_big(self):
        patt = BigText.PATT
        for j in patt[self.num_id]:
            print(j)
    def get_line(self, line):
        patt = BigText.PATT
        return patt[self.num_id][line]
if __name__ == "__main__":
    # big8 = BigText(3)
    # big8.show_big()
    big8 = BigText(8)
    big3 = BigText(3)
    big4 = BigText(4)
    for i in range(5):
        print("{0} {1} {2}".format(big8.get_line(i),
                                     big3.get_line(i), big4.get_line(i)))