Display Output While Inside Of Raw_input()
I am implementing a chat server, and I currently have a list of client sockets I'd like to send information through, the issue is that the client exists in a raw_input() state in o
Solution 1:
Since (as @thefourtheye said) raw_input
is an I/O block on the main thread, so you need to create a separate thread to print messages.
Multithreading solution:
>>> defprint_message():
time.sleep(5)
print"message">>> bgThread = Thread(target=print_message)
>>> bgThread.start()
>>> x = raw_input()
message
inputis entered here
>>> print x
inputis entered here
Use a separate Thread
for receiving and printing messages.
Post a Comment for "Display Output While Inside Of Raw_input()"