Hi, Liam Clarke-Hutchinson wrote: Ok. Thanks for the heads up.Hi Joseph,while (1): buffer = Data.IRC.recv(1024) msg = string.split(buffer)Just a warning, the string module will be removed/deprecated come Py3K. Better to use - buffer.split() nick_name = msg[0][:msg[0].find("!")] filetxt.write(nick_name.lstrip(':') + ' -> ' + message.lstrip(':') + '\n') Oh, sorry. I'm refering to the print msg[print_msg]As to your printing problem, I'm not sure if you're referring to -print msg[print_msg] Well every word is on it's own new line (I get a huge message from the IRC server) and I'd like a word wrap or something to fix that.And I'm not sure if you want it to print without an additional newline, or with a newline. Ah. Thanks#Incidentally, it's a bit simpler to maintain this kinda loop #instead of a while loop. for item in msg: item.rstrip() #Will strip whitespace (\t\r\n etc.) by default print item Thanks again. This is proving very usefull.If you're wanting to print without the newline that print adds, why not do a join like this one? message = ' '.join(msg[3:]) print ' '.join(msg) ? I'm expecting a large amount of text without new lines for each word, and possible word wrapping.What output you're expecting Example:What output you're getting this is the type of message I'm getting and as you can see , it's really annoying! I edited the code from a Python Cookbook recipe.PS Your code is interesting, I've never dealt with the IRC protocol before,so it's good to see a demonstration of it. Yes. Some people on a forum that I hang oput with suggested a chat room. A freind of mine suggested IRC and python. He's doing the server and I'm doing the client. I'm testing the client on freenode.. only thing I could think of at the time.I may toddle off and check out that RFC. |
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor