codehaus


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Incoming datas difficult to read "\r\n" and "\n"


I'm experimenting with irc bot. I've made it connecting, reading etc but
everything is difficult to read.

It's coming like one long string without breaking lines.
How to mace it printing in new line after: \r\n or \n in data?
------

b':weber.freenode.net 001 saaaki :Welcome to the freenode Internet Relay
Chat Network saaaki\r\n:weber.freenode.net 002 saaaki :Your host is
weber.freenode.net[162.213.39.42/6667], running version
ircd-seven-1.1.9\r\n:weber.freenode.net 003 saaaki :This server was
created Wed Dec 18 2019 at 21:37:52 UTC\r\n:weber.freenode.net 004
saaaki weber.freenode.net ircd-seven-1.1.9 DOQRSZaghilopsuwz
CFILMPQSbcefgijklmnopqrstuvz bkloveqjfI\r\n:weber.freenode.net 005
saaaki CHANTYPES=# EXCEPTS INVEX CHANMODES=eIbq,k,flj,CFLMPQScgimnprstuz
CHANLIMIT=#:120 PREFIX=(ov)@+ MAXLIST=bqeI:100 MODES=4 NETWORK=freenode
STATUSMSG=@+ CALLERID=g CASEMAPPING=rfc1459 :are supported by this
server\r\n:weber.freenode.net 005 saaaki CHARSET=ascii NICKLEN=16
CHANNELLEN=50 TOPICLEN=390 DEAF=D FNC
TARGMAX=NAMES:1,LIST:1,KICK:1,WHOIS:1,PRIVMSG:4,NOTICE:4,ACCEPT:,MONITOR:
EXTBAN=$,ajrxz CLIENTVER=3.0 SAFELIST ELIST=CTU KNOCK :are supported by
this server\r\n:weber.freenode.net 005 saaaki CP
------------------------------------------

My code:
--------------
while 1:
	time.sleep(2)
	data=s.recv(2040)
	print(data)
	if data.find(b"PING"):
		s.send(b"PONG :pingis")

-----------------