import pysrt, argparse ap = argparse.ArgumentParser("srttojs") ap.add_argument("srt") args = ap.parse_args() srt= pysrt.open(args.srt) print("
") for t in srt: print ('
{0} {2}
'.format(t.start, t.start.ordinal/1000.0, t.text)) print ("
")