Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- testlines = []
- keep_phrases = ["150=2","150=1"]
- directory = "C:\temp\test"
- for filename in os.listdir(directory):
- with open(os.path.join(directory, filename)) as curfile:
- for line in curfile:
- for phrase in keep_phrases:
- if phrase in line:
- testlines.append(line)
- for line in testlines:
- try:
- date = line.split('|75=')[1].split('|',1)[0]
- print(date)
- except:
- print(line)
Add Comment
Please, Sign In to add comment