淘先锋技术网

首页 1 2 3 4 5 6 7
from openpyxl import *
filename = '20191009_1454_S1_Temp.xlsx'
wb = load_workbook('C:/Users/Administrator/Desktop/'+filename)#装载文件
ws = wb.active
for i in range(1,ws.max_row+1):#最大行数
    print(i ,ws.cell(i,2).value)#指定单元格的值
    if(ws.cell(i,2).value==0):
        ws.delete_rows(i,1) #删除index为i后面的1行
wb.save('C:/Users/Administrator/Desktop/'+filename)#保存文件