-
-
Save hiiwave/ddeacf3c78485c5fe742f4c67e08655b to your computer and use it in GitHub Desktop.
Convert subtitles to plain text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import re | |
import textwrap | |
def str2txt(srt): | |
lines = re.sub(r'^$\n|^[0-9].*\n|^\n','', srt, flags=re.MULTILINE | re.UNICODE) | |
print(textwrap.fill(lines, 70)) | |
if __name__ == '__main__': | |
str2txt(open(sys.argv[0]).read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment