import re
url= r'http://ycww/indexCount.do?method=\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\..\\windows\a'
print(url)
len(re.findall(r"[\\]", url,re.IGNORECASE))
注意:如果删掉url末尾的a,会报错
url1='\\'+url
print(url1)
re.findall(r"[\\]", url1,re.IGNORECASE)
with open('22222.txt',encoding='utf-8') as f:
for line in f:
print(line)
print(re.findall(r"[\\]", line,re.IGNORECASE))
print(len(re.findall(r"[\\]", line,re.IGNORECASE)))
a=line
a