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

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Using path module

Here's an example codes using path module.
You first need to download it here: path.py
   1  
   2  # make some files excutable
   3  d = path('/usr/home/guido/bin')
   4  for f in d.files('*.py'):
   5      f.chmod(0755)
   6  
   7  # Directory walking - delete Emacs backup files
   8  d = path(os.environ['HOME'])
   9  for f in d.walkfiles('*~'):
  10      f.remove()

Using os.path is difficult. I can hardly remember how to
use which method. Need to lookup the manual every time.
This path module is much much easier to use.
I've heard it will be included in python 2.5 as well.
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS