Th3NiKo

TXT - Clearing without words

Dec 9th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. import re     #REGEX
  2. import glob   #Search files
  3. import fitz   #PyMuPDF 1.14.2
  4.  
  5. #REGEX
  6. pattern = "[a-zA-Z]"
  7.  
  8. enList = glob.glob('./EN*')
  9. hrList = glob.glob('./HR*')
  10. wholeList = enList + hrList
  11.  
  12. for file in wholeList:
  13.      with open(file, "r+", encoding="utf-8") as f:
  14.           with open(file+"CLEAN.txt", "a+", encoding="utf-8") as n:
  15.               for line in f:
  16.                   if not re.match(pattern, line) == None:
  17.                       n.write(line)
Advertisement
Add Comment
Please, Sign In to add comment