CAFE

1. 파이썬 수업

Re: 오늘의 마지막 문제. 자동화 스크립트 2번을 아래의 막대 그래프를 출력하는것으로 변경하시오 !

작성자21_장호철|작성시간25.06.26|조회수12 목록 댓글 0

from collections import Counter

import pandas as  pd

from tabulate import tabulate

 

oracle_alert = open("C:\\data\\alert_log.txt", encoding='utf8')

oracle_text=oracle_alert.read()

lines = oracle_text.split('\n')

error_list=[]

 

while True:

    print("😀=========================================😀")

    print('dba 작업을 편하게 하기 위한 자동화 스크립트')

    print('😀1. alert log file 뒷부분')

    print('😀2. 오라클 에러 갯수 시각화')

    print('😀3. 전체 에러 메시지 종류 개수 세기')

    print('😀9. 프로그램 종료')

    print('==========================================')

    num=input('번호를 입력해주세요 : ')

 

    if num == '1':

        print(oracle_text[-700:])

        break

   

    elif num == '2':                    

         for i in lines:

            if 'ORA-' in i:

                error_list.append(i.split()[0].strip(':'))

             

         x = df_sort.loc[ :, ['에러번호']] #y축

         y = df_sort.loc[ :, ['건수']] #x축

 

         plt.xticks(rotation=45)

         plt.bar(x['에러번호'],y['건수'], color = 'lightcoral')

         plt.show()

         break

 

    elif num == '3':

        for i in lines:

            if 'ORA-' in i:

                error_list.append(i.strip(':'))

        print(Counter(error_list))

        break

   

    elif num =='9':

        break

 

 

다음검색
현재 게시글 추가 기능 열기

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼