pysrt - Python module to create .srt files
Building on what @cherhan said, consider using the pysrt library.
You can find the library here: http://pypi.python.org/pypi/pysrt/0.2.2
If you have problems using the library, comment below and maybe I can write some code to demonstrate how it would be used in this particular situation (although I feel that the problem is trivial at this point).