Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os, re
- for path, dirs, files in os.walk('.'):
- for file in files:
- if re.match('.+\.(php|css|js)|\.htaccess', file, re.IGNORECASE):
- f = open(path + '\\' + file, 'r+b')
- content = f.read()
- content = content.replace('\r', '')
- content = content.replace('\t', ' ')
- content = re.sub(' +$', '', content, flags=re.MULTILINE)
- content = re.sub('\n+$', '', content)
- f.truncate(0)
- f.seek(0)
- f.write(content)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment