cxyd4399
FuckWindowsError
采纳率50%
2018-12-03 04:18

关于PYTHON使用with open配合For读取文件运行至For循环停止执行的疑问?

已采纳
                with open(self.userList,'r') as f_username:
            UserListCount=len(list(f_username))
            print(UserListCount)
            with open(self.passList,'r') as f_password :
                for name in f_username:
**************************请问以下代码为何不会执行?**********************
                    if Finished == 1 or UserBreak ==1:  
                        break
                    UserTryCount=UserTryCount+1
                    print("正在pojie"+name+"进度表:"+str(UserTryCount)+"/"+UserListCount)
                    for key in f_password:
                        if Finished==1 or UserBreak==1 or PassBreak ==1:
                            break
                        if AllCount % 10 == 0:
                            print("已尝试"+str(AllCount)+"个")
                        if len(key)<self.MiniLen:
                            continue 
                        try:
                            AllCount=AllCount+1
                            if  self.Login(name,key)==True:
                                self.SuccesList.append(name+FG+key)
                                PassBreak= 1
                            elif Login==False :
                                continue
                            else :
                                UserBreak=1
                        except Exception as e:
                            print("抱歉,发生异常错误"+str(e))
                            continue
        if Finished!=1 and UserBreak!=1:
            print("抱歉,在此字典中并未找到正确的密码")
    except Exception as e:
        print(e)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • cxyd4399 FuckWindowsError 3年前

    自己已经解决了。。。。。。。。

    点赞 评论 复制链接分享

相关推荐