代码
有问题的代码如下:
# 未找到资源的keys 集合
unFinded = set(self.getJsonAnalysis(jsonPath))
str_pattern = re.compile(r".*[0-9]$")
for unfind in unFinded:
if not str_pattern.match(unfind) and not unfind.endswith('empty') and not unfind.endswith('Default'):
unFinded.remove(unfind)
print("remove :{}".format(unfind))
return unFinded
解决问题的代码:copy()
# 未找到资源的keys 集合
unFinded = set(self.getJsonAnalysis(jsonPath))
str_pattern = re.compile(r".*[0-9]$")
for unfind in unFinded.copy():
if not str_pattern.match(unfind) and not unfind.endswith('empty') and not unfind.endswith('Default'):
unFinded.remove(unfind)
print("remove :{}".format(unfind))
return unFinded