import re,fileinput,os
for path, dirs, files in os.walk(path):
for filename in files:
fullpath = os.path.join(path, filename)
# open for reading first since we need to get the text out
f = open(fullpath,'r')
# step 1
data = f.read()
patter = re.compile('//inicio-borrar-inicio.*?//fin-borrar-fin', re.I | re.S)
data = patter.sub("", data)
# step 2
f.close()
# *now* open for writing
f = open(fullpath, 'w')
# step 3
f.write(data)
f.close()