解析彩虹表输出错误我不理解

时间:2017-07-05 16:20:12

标签: python python-2.7 typeerror

我正在为彩虹表创建一个解析器,并希望读取该文件的1024个字节来决定文件被拆分的内容,无论是: ; . ,还是空格。但是,当我尝试在文件中找到解析器时,我收到一条错误,指出TypeError: 'in <string>' requires string as left operand, not list。我最好的猜测是错误来自这条线for item in table.read(1024):,但我不确定我在这里做错了什么。任何帮助将不胜感激:

def is_valid_table(tablename):
    possible_parsers = [";", ".", ":", ","]
    with open(tablename) as table:
        if possible_parsers not in table.read():
            raise EnvironmentError(
                "Your rainbow table does not contain the correct parsers "
                "valid parser are '{}'. Refractor your rainbow table and try "
                "parsing it once more.".format(possible_parsers)
            )
        else:
            for item in table.read(1024):
                for parser in possible_parsers:
                    if parser in item:
                        return parser

0 个答案:

没有答案