create subtitle with python
# .srt is one of the most common exentions of subtitle files.
with open('subtitle.srt', 'w') as srt_file:
# we should to write subtitle file in folowing format:
# text_id
# start_time --> end_time
# text
context = """
1
00:00:00 --> 00:00:03
text_1
2
00:00:03 --> 00:00:06
text_2
"""
srt_file.write(context)