From 06440fd89ee48cb40f9e408d23d27b1c9553f2fe Mon Sep 17 00:00:00 2001 From: rany Date: Thu, 10 Mar 2022 12:43:26 +0200 Subject: [PATCH] strip trailing newlines --- examples/02_subrip_to_mp3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/02_subrip_to_mp3.py b/examples/02_subrip_to_mp3.py index 69551a5..cf7980c 100755 --- a/examples/02_subrip_to_mp3.py +++ b/examples/02_subrip_to_mp3.py @@ -15,7 +15,7 @@ if shutil.which("ffmpeg") is None: def parse_srt(srt_file): with open(srt_file, "r") as f: - data = f.read().split("\n\n") + data = f.read().strip().split("\n\n") data = [i.strip() for i in data] data = [(*i.split("\n")[:2], " ".join(i.split("\n")[2:])) for i in data] data = sorted(data, key=lambda x: int(x[0]))