import re
def readfile(path):
f=open(path)
lines=f.readlines()
f.close()
return lines
def writefile(path,lines):
f=open(path,'w')
f.writelines(lines)
f.close()
def processContents(lines):
for i in range(len(lines)):
if(lines[i]):
lines[i] = re.sub('http:','https:',lines[i])
return lines
def processFile():
paths=['E:\tt.txt']
for path in paths:
lines=readfile(path)
processContents(lines)
writefile(path,lines)
processFile()