标签:bsp row append test not listdir ext read 解析
import xlwt import openpyxl import xlrd def eq(l): workbook = xlrd.open_workbook(‘data.xlsx‘) table = workbook.sheet_by_index(0) all_data=[] url=[] test=[] for i in range(0,table.nrows): u = table.cell(i, 1).value ip=table.cell(i,0).value #print(ip) if u not in l: print(u,"\t",ip) def chooseInfo(dir): l=[] list = os.listdir(dir) for i in range(0, len(list)): path = os.path.join(dir, list[i]) if os.path.isfile(path): with open(path, encoding="utf-8") as f: content = f.read() doc = pq(content) # 解析html 文本 item = doc("h1") s=((item.eq(2).text())) #获取相应标签文本 #if int(item.eq(1).html()) > 0 or int(item.eq(3).html()) > 0: l.append(s) #print("操作全部完成!") return(l) a=[] a=chooseInfo("C:\\Users\\yxb\\Downloads\\新") eq(a)
标签:bsp row append test not listdir ext read 解析
原文地址:https://www.cnblogs.com/kk328/p/13494429.html