Skip to content

Instantly share code, notes, and snippets.

@aji
Created April 11, 2013 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aji/5360228 to your computer and use it in GitHub Desktop.
Save aji/5360228 to your computer and use it in GitHub Desktop.
class linebuf:
def __init__(self):
self.s = ['']
def data(self, data):
self.s[-1:] = (self.s[-1] + data).split('\r\n')
lines, self.s = self.s[:-1], self.s[-1:]
return lines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment