1
我已经用尽了msvcrt.kbhit()在Python中如何可以打印出数据,只要我点击指定的键需要按下的想法用完了。它看起来像while循环需要再次循环,才能打印出我的愿望输出。有人可以帮帮我吗。这里是我的代码:Python套接字线程与kbhit
def run(self):
global state
print "\nClient connection received!\n"
self.channel.send("Status: Server connection received")
while 1:
ctr = 1
while 1:
self.clientmess = self.channel.recv(Buffer)
if msvcrt.kbhit():
if msvcrt.getch() == 's':
print "stop"
break
#the codes belo is what i will want for self.clientmess will be so its not necessary I think to put
究竟是什么问题? – wRAR 2013-03-20 14:49:59
当代码从客户端接收数据时,我按下键盘上的's'键打印停止不打印,因为我按下了键,它需要另一个数据才能在打印“停止”之前接收,以便在屏幕上打印 – 2013-03-20 14:54:04