Guest User

Untitled

a guest
Jan 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import os
  2.  
  3. testlines = []
  4. keep_phrases = ["150=2","150=1"]
  5.  
  6. directory = "C:\temp\test"
  7. for filename in os.listdir(directory):
  8. with open(os.path.join(directory, filename)) as curfile:
  9. for line in curfile:
  10. for phrase in keep_phrases:
  11. if phrase in line:
  12. testlines.append(line)
  13.  
  14. for line in testlines:
  15. try:
  16. date = line.split('|75=')[1].split('|',1)[0]
  17. print(date)
  18. except:
  19. print(line)
Add Comment
Please, Sign In to add comment