I am facing a problem with converting seconds.milliseconds into hh:mm:ss,mmm format in python. Please refer to my code below.
with open('SubRip.srt','r',encoding='UTF-8') as f:
json_data=json.load(f)
def ss2HMS(a):
for i in json_data:
import time
var= float(a)
return time.strftime('%H:%M:%S.%f',time.gmtime(var))
I am trying to fetch startTime from a SRT file( which I converted into a json file) and now again that I want to make its time into SRT format, I am just trying it to make into hh:mm:ss,mmm format. The startTime in json is in seconds.millisecond format. I was able to get hh:mm:ss but not hh:mm:ss,mmm. milliseconds is not getting added. Does anybody have any idea about this?
Any help is appreciated.
Thanks for reading.