Hi,

Liam Clarke-Hutchinson wrote:
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')
  
Ok. Thanks for the heads up.
As to your printing problem, I'm not sure if you're referring to - 
print msg[print_msg]
    

  
Oh, sorry. I'm refering to the print msg[print_msg]
And I'm not sure if you want it to print without an additional newline, or
with a newline. 
  
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.
#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
  
Ah. Thanks
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) ?

  
Thanks again. This is proving very usefull.
What output you're expecting
  
I'm expecting a large amount of text without new lines for each word, and possible word wrapping.
What output you're getting

  
Example:
this
is
the
type
of
message
I'm
getting
and
as
you
can
see
,
it's
really
annoying!

PS Your code is interesting, I've never dealt with the IRC protocol
before,so it's good to see a demonstration of it.
I edited the code from a Python Cookbook recipe.
 I may toddle off and check
out that RFC.
  
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.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to