Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Edit Subtitle Python

f=r'E:\TVS\DLOT\3\DLOT.S03E13.srt'
a=open(f,'r').read()
import re
t=21
z=r'(\d+):(\d+):(\d+)'
for i in re.findall(z,a):
zz=int(i[0])*3600+int(i[1])*60+int(i[2])+t
z2=zz//3600
x,b=divmod(zz%3600,60)
v='{:02}@:{:02}:{:02}'.format(z2,x,b)
a=re.sub(z,v,a,1)
z2=r'(\d+)@:(\d+):(\d+)'
z3=r'\1:\2:\3'
a=re.sub(z2,z3,a)
print(a,file=open(f,'w'))


This post first appeared on SMARTMANOJ, please read the originial post: here

Share the post

Edit Subtitle Python

×

Subscribe to Smartmanoj

Get updates delivered right to your inbox!

Thank you for your subscription

×