Guest User

Untitled

a guest
Feb 23rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import re
  2. import os
  3.  
  4. PATH = "/usr/share"
  5. counter = 0
  6. for path, dirs, files in os.walk(PATH):
  7.     for filename in files:
  8.         fullpath = os.path.join(path, filename)
  9.         try:
  10.             with open(fullpath, 'r') as f:
  11.                 for line in f:
  12.                     if "sublime" in line:
  13.                         print f
  14.                         counter += 1
  15.         except IOError:
  16.             continue
  17.  
  18. print counter
Add Comment
Please, Sign In to add comment