Skip to content

Instantly share code, notes, and snippets.

@copyleftdev
Created April 1, 2016 23:20
Show Gist options
  • Save copyleftdev/7f0879ba85ce7d46667ba51417fe266c to your computer and use it in GitHub Desktop.
Save copyleftdev/7f0879ba85ce7d46667ba51417fe266c to your computer and use it in GitHub Desktop.
import re
import os
import fileinput
import uuid
def getDocList(rootFoldr):
filelst = []
for(dirpath, _, files) in os.walk(rootFoldr):
for filename in files:
filepath = os.path.join(dirpath, filename)
filelst.append(filepath)
return (filelst)
def textsane(rootFoldr):
flist= getDocList(rootFoldr)
pattern = re.compile("<([^>]+)>")
for each_file in flist:
for line in fileinput.input(each_file, inplace=True):
if not re.search(pattern, line):
print line
textsane('data')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment