I wrote a little IRC client using sockets. And no I don't want to use a libary like twisted. ;)I am printing messages to stdout and that works all good. Is there a good way to print new messages but also listen to user input with something like threading? Here is a little snippet:
from threading import Thread
import time
def print_stuff():
while True:
print "New PRIVMSG!"
time.sleep(2)
t = Thread(target=print_stuff)
t.start()
while True:
raw_input(">>")
This produces not quite the output that I need... Output looks something like this:
>>New PRIVMSG!
test test tesNew PRIVMSG!
Is there a way to make this work in cmd or bash?
Thank you in advance!
Edit: Output should look like this.
New PRIVMSG!
New PRIVMSG!
>> hello test
New PRIVMSG!