readlines() on a socket

Gregory Bond gnb at itga.com.au
Tue Oct 23 23:59:59 EDT 2001


I'd like to be able to do
	
	s = socket.socket(...)
	s = socket.connect(....)
	for l in s.readlines():
		# process line l

but sockets don't support readline(), or readlines(), or anything
similar that I can see.

Is there away to do this that doesn't involve manually calling split
on the results of s.recv() and worrying about whole lines split across
recv() calls?



More information about the Python-list mailing list