#!/usr/bin/python
import os
path = os.getcwd()
def Del():
for foldName, subfolders, filenames in os.walk(path):
for filename in filenames:
if filename.endswith('.sv'):
with open(os.path.join(foldName,filename),"r") as f:
lines=f.readlins()
with open(os.path.join(foldName,filename),"w") as f:
for l in lines:
if 'XXX' not in l://delete the row including the text of XXX
f.write(l)
Del()
print('ok!!!!')