Advertisement
Guest User

bandit_4_to_5_solver

a guest
Oct 19th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. import os
  2. from string import printable
  3.  
  4. FILES_DIR = '/home/bandit4/inhere/'
  5. alphabet = printable + '\n'
  6.  
  7. def is_valid_file(fn):
  8.     with open(fn) as f:
  9.         content = f.read()
  10.  
  11.     for ch in content:
  12.         if ch not in alphabet:
  13.             return False
  14.  
  15.     return True
  16.  
  17. os.chdir(FILES_DIR)
  18. filenames = os.listdir('.')
  19.  
  20. for fn in filenames:
  21.     if is_valid_file(fn):
  22.         print(FILES_DIR + fn)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement