发现三级弹窗

import shutil,os
from lxml import etree

filePath = "E:\\S1"

def FindLevel3Window(filePath):  
   fillDict = {"isWindow" : False, "fileName" : ""}
   html = etree.parse(filePath, etree.HTMLParser())
   result = html.xpath('//@skinname')
   for attr in result:
      ReplaceStr(str(attr), "/", "S1", "S2")
      if attr == "skins.ThirdPanelSkin3" or attr == "skins.ThirdPanelSkin3_Scacle":
         fillDict["isWindow"] = True
         fillDict["fileName"] = filePath
   return fillDict

def FindAppointStr(strInfo, appointStr):
   for str in strInfo:
      if str == appointStr:
         return True
   return False

def ReplaceStr(str1, splitStr, findStr, replaceStr):
   if isinstance(str1, str) and isinstance(splitStr, str):
      str2 = ""
      strInfo = str1.split(splitStr)
      print(len(strInfo))
      for attr in strInfo:
         if attr == findStr:
            attr = replaceStr
         str2 = str2 + attr + "/"
      print(str2)
   else:
      print("Erro: The input is not a character")

def TraverseAllFile(filePath):
   fileTotal = 0
   file_dir = os.walk(filePath, topdown=True)
   for path,dir_list,file_list in file_dir:
      pathInfo = path.split("\\")
      isAppointStr = FindAppointStr(pathInfo, "S1")
      if isAppointStr:
         for file_name in file_list:
            pathName = os.path.join(path, file_name)
            fillDict = FindLevel3Window(pathName)
            if fillDict["isWindow"]:
               fileTotal = fileTotal + 1
               print(fillDict["fileName"])
   print(u"fileTotal num:", fileTotal)

if __name__ == '__main__':
   TraverseAllFile(filePath)



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值