Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Manipulate files and directory easily with path.py (on pys60) (See related posts)

I really like Jason Orendorff's path.py.
So, I modify it a bit to use with pys60.
- don't load fnmatch, glob, codecs
- remove some functionalities and some docstrings
- match wildcard with regexp simplisticly
   1  
   2  #return fnmatch.fnmatch(self.name, pattern)
   3  
   4  # poor man's fnmatch
   5  pattern = pattern.replace('.', '\\.').replace('*','.*').replace('?','.')
   6  return re.match(pattern, self.name)

But most of it works nicely. Please report bugs in comments.
Download it here path.py.


You need to create an account or log in to post comments to this site.


Click here to browse all 5562 code snippets

Related Posts