简体   繁体   English

为什么循环不能停止?

[英]Why the loop can't stop?

I have a problem that the loop doesn't want to stop.我有一个问题是循环不想停止。

f = open(the_file[0], "w+b")
recvd = " "
while True:
    data = s.recv(4096)
    if not data: 
        print("Done") 
        break
    recvd += str(data)
f.write(recvd)
f.close()

Can anyone help me?谁能帮我?

I think it is a typo in the program我认为这是程序中的错字

you want this line to be你希望这条线是

data = f.recv(4096)

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

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