简单来源
class page:
pages = "/.././ewcwe/../qds/./qwd/qwf/qwd/../../../sad/qwd/../sad/qwd/sad/.././../../../../bbs/./board.php?bo_table=humor&wr_id=195?los=09&qwe=2&"
def __init__(self):
self.normalize()
def normalize(self):
for j in range(1, len(self.pages)):
if self.pages[j-1] != "." and self.pages[j] == "." and self.pages[j+1] == "/":
self.pages = self.pages[:j] + self.pages[j+2:]
print self.pages
print self.pages
index = page()
没有问题,但发生错误。为什么会出现错误?