title: Creating a csv-file from an srt-file ("Friends" subtitles) in python
body: <p>Currently, I am trying to create a csv file containing the subtitles of NBC's "Friends" and their corresponding starting time. So basically I am trying to turn an srt-file into a csv-file in python.</p>
  
  <p>For those of you that are unfamiliar with srt-files, they look like this:</p>
  
  <pre><code>1
  00:00:47,881 --&gt; 00:00:49,757
  [CAR HORNS HONKING]
  
  2
  00:00:49,966 --&gt; 00:00:52,760
  There's nothing to tell.
  It's just some guy I work with.
  
  3
  00:00:52,969 --&gt; 00:00:55,137
  Come on.
  You're going out with a guy.
  
  …
  </code></pre>
  
  <p>Now I have used <code>readlines()</code> to turn it into a list like this:</p>
  
  <pre><code>['\ufeff1\n', '00:00:47,881 --&gt; 00:00:49,757\n', '[CAR HORNS HONKING]\n',
  '\n', '2\n', '00:00:49,966 --&gt; 00:00:52,760\n',
  "There's nothing to tell.\n", "It's just some guy I work with.\n",
  '\n', '3\n', '00:00:52,969 --&gt; 00:00:55,137\n', 'Come on.\n',
  "You're going out with a guy.\n", ...]
  </code></pre>
  
  <p>Is there a way to create a dict or dataframe from this list (or the file it is based on) that contains the starting time (end time is not needed) and the lines that belong to it. I've been struggling because while sometimes just one line corresponds to a starting time, other times there are two (There are two lines at most per starting time in this file. However, a solution that can be used in case even more lines are present would be preferable).</p>
  
  <p>Lines that look like the first one ("[CAR HORNS HONKING]") or others that simply say e. g. "CHANDLER:" and their starting times would ideally not be included but that's not all that important right now.</p>
  
  <p>Any help is very much appreciated!</p>