27
edits
| No edit summary | |||
| Line 21: | Line 21: | ||
| === Auto_detecting_words_in_srt === | === Auto_detecting_words_in_srt === | ||
| [[File:guichu.txt]] | [[File:guichu.txt]] | ||
| Copy the txt file to a empty .py file :) (.py file can't be uploaded, I wonder why @_@) | |||
| #library srt link: https://github.com/cdown/srt | #library srt link: https://github.com/cdown/srt | ||
| #pip install -U srt | #pip install -U srt | ||
| #copy paste srt file as  | #copy paste srt file as in the code (focus on the format at head and tail) | ||
| #it returns a sequence of subtitle classes object, contains index,time, | #it returns a sequence of subtitle classes object, contains index,time, content, etc. | ||
| #using for loop searching desired word in every object.content. | #using for loop searching desired word in every object.content. | ||
| #it returns the time interval at the start and the end | #it returns the time interval at the start and the end | ||
| #use srt.timedelta_to_srt_timestamp convert the time to normal one | #use srt.timedelta_to_srt_timestamp convert the time to normal one | ||
edits