简体   繁体   English

Python while 在 for 循环内

[英]Python while inside of for loop

Everything works but when it gets back to the while loop for the second time, it doesn't execute the the "for USER" part again.一切正常,但是当它第二次返回 while 循环时,它不会再次执行“for USER”部分。

# SEND PASSWORD FROM LIST s.send("\r\n") # RECIEVE DATA Attempts Remaining: 70 1 0 73

Your passwordlist has value greater than 70 at the beginning.您的passwordlist开头的值大于 70。 When you check passwords for users, you check whether passwordlist is greater then 70. If it's not, while loop executes no iteration.当您检查用户的密码时,您会检查passwordlist是否大于 70。如果不是,while 循环不执行任何迭代。 You decrement this value when password fails, but you don't reset it for the next user.当密码失败时,您会减少此值,但不会为下一个用户重置它。 Add添加

passwordlist = number_of_attempts

just before executing this while loop (replacing number_of_attempts with desired value).就在执行此 while 循环之前(用所需值替换number_of_attempts )。

Your condition for the loop that controls sending passwords is while passwordlist > 70: but passwordlist is never reset back.您控制发送密码的循环的条件是while passwordlist > 70: but passwordlist is never reset back. The "Attempts remaining" line shows that it is 0, which means that the condition is false and the loop will not repeat. “剩余尝试次数”行显示为 0,表示条件为假,循环不会重复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM