diff options
-rwxr-xr-x | Lib/mailbox.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/mailbox.py b/Lib/mailbox.py index f965b0f..3c758ff 100755 --- a/Lib/mailbox.py +++ b/Lib/mailbox.py @@ -66,6 +66,19 @@ class _Subfile: self.pos = self.fp.tell() return data + def readlines(self, sizehint = -1): + lines = [] + while 1: + line = self.readline() + if not line: + break + lines.append(line) + if sizehint >= 0: + sizehint = sizehint - len(line) + if sizehint <= 0: + break + return lines + def tell(self): return self.pos - self.start |