rfmonk

ospath_commonprefix.py

Jan 26th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. import os.path
  2.  
  3. paths = ['/one/two/three/four',
  4.          '/one/two/threefold',
  5.          '/one/two/three/',
  6.          ]
  7.  
  8. for path in paths:
  9.     print 'PATH:', path
  10.  
  11. print
  12. print 'PREFIX:', os.path.commonprefix(paths)
Advertisement
Add Comment
Please, Sign In to add comment