From 20bb47e4698912d860a67ababbfff4659ef49311 Mon Sep 17 00:00:00 2001 From: David Zhuang Date: Tue, 13 Sep 2016 22:25:20 -0400 Subject: [PATCH] Make SrtFile Iterable --- pysrt/srtfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pysrt/srtfile.py b/pysrt/srtfile.py index c03595a..7e654a4 100644 --- a/pysrt/srtfile.py +++ b/pysrt/srtfile.py @@ -51,6 +51,9 @@ def __init__(self, items=None, eol=None, path=None, encoding='utf-8'): self.path = path self.encoding = encoding + def __getitem__(self, index): + return self.data[index] + def _get_eol(self): return self._eol or os.linesep