A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/316703.html below:

Record separator for readlines()

Record separator for readlines() Record separator for readlines()jepler at unpythonic.net jepler at unpythonic.net
Fri Sep 2 23:10:18 EDT 2005
I think you still have to roll your own.

Here's a start:
	def ireadlines(f, s='\n', bs=4096):
	    if not s: raise ValueError, "separator must not be empty"
	    r = []
	    while 1:
		b = f.read(bs)
		if not b: break
		ofs = 0
		while 1:
		    next = b.find(s, ofs)
		    if next == -1: break
		    next += len(s)
		    yield ''.join(r) + b[ofs:next]
		    del r[:]
		    ofs = next
		r.append(b[ofs:])
	    yield ''.join(r)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050902/c449a923/attachment.sig>
More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4