# -*- coding: utf-8 -*- # 범용 N 적용: python _cb_applyN.py <엑셀> <이미지행 csv> (몽타주 시각판정 이미지행만 어문,이미지 / M0게시판 없음) import openpyxl, sys, io sys.stdout=io.TextIOWrapper(sys.stdout.buffer,encoding='utf-8') F=sys.argv[1] IMG=set(int(x) for x in sys.argv[2].split(',') if x.strip()) 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 for r in range(3,ws.max_row+1): if ws.cell(r,12).value=='게시판' and ws.cell(r,13).value in (0,None) and 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)))