Greg> To avoid duplication of effort, how about a single function that Greg> does both: >>> files = ["/home/swen", "/home/swanson", "/home/jules"] >>> os.path.factorize(files) ("/home", ["swen", "swanson", "jules"]) Since we already have os.path.commonprefix and it's not going away, it seemed to me that just adding a complementary function to return the suffixes made sense. Also, there's nothing in the name factorize that suggests that it would split the paths at the common prefix. It could easily be written in terms of the two: def factorize(files): pfx = os.path.commonprefix(files) suffixes = os.path.suffixes(pfx, files) return (pfx, suffixes) Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4