create subtitle with python

Solutions on MaxInterview for create subtitle with python by the best coders in the world

showing results for - "create subtitle with python"
Léopold
03 Aug 2020
1# .srt is one of the most common exentions of subtitle files.
2with open('subtitle.srt', 'w') as srt_file:
3  # we should to write subtitle file in folowing format:
4  # text_id
5  # start_time --> end_time
6  # text
7  context = """
8  1
9  00:00:00 --> 00:00:03
10  text_1
11  
12  2
13  00:00:03 --> 00:00:06
14  text_2
15  
16  """
17  srt_file.write(context)