# -*- coding: utf-8 -*- import openpyxl, sys, io, json sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8') F='1.괴산군\\충청북도_괴산군.xlsx' IMG={83,116,138,144,150,152,183,184,185,190,191,196,197,202,203,208,209,214,215, 220,222,227,228,233,234,239,240,245,246,251,257} wb=openpyxl.load_workbook(F); ws=wb.active chg=0 for r in IMG: if ws.cell(r,14).value!='어문,이미지': ws.cell(r,14).value='어문,이미지'; chg+=1 # M0 게시판 → 없음(빈게시판) : 총게시물 0인 board만 m0=0 for r in range(3,ws.max_row+1): if ws.cell(r,12).value=='게시판' and ws.cell(r,13).value in (0,None): if ws.cell(r,14).value=='어문': ws.cell(r,14).value='없음'; m0+=1 wb.save(F) from collections import Counter d=Counter(ws.cell(r,14).value for r in range(3,ws.max_row+1)) print('이미지승격 %d | M0없음 %d | 최종N %s'%(chg,m0,dict(d)))