Created
          December 21, 2011 20:04 
        
      - 
      
- 
        Save aliang/1507475 to your computer and use it in GitHub Desktop. 
    recursive globbing
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def find_files(directory, pattern): | |
| for root, dirs, files in os.walk(directory): | |
| for basename in files: | |
| if fnmatch.fnmatch(basename, pattern): | |
| filename = os.path.join(root, basename) | |
| yield filename | |
| for f in find_files(".", "*.txt"): | |
| print f | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment