Advertisement
rooseal

Search-strings

Oct 9th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. #Import os module
  2. import os
  3.  
  4. my_set = set(line.strip() for line in open('testinputlist.txt'))
  5.  
  6. path = "."
  7. listing = os.listdir(path)
  8. for filename in listing:
  9.     with open(filename, 'r+') as f:
  10.         line = f.readlines()
  11.         search = line.[13:24]
  12.         if any(x in search for x in my_set):
  13.             my_list.remove(search)
  14.         else:
  15.             print "Nothing here to see in " + filename
  16.            
  17.         if my_set == 0:
  18.             print filename + " contains all search terms"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement