|
|
|||
File indexing completed on 2026-04-09 07:49:13
0001 #!/usr/bin/env python 0002 0003 def commonprefix(m): 0004 "Given a list of pathnames, returns the longest common leading component" 0005 if not m: return '' 0006 s1 = min(m) 0007 s2 = max(m) 0008 for i, c in enumerate(s1): 0009 if c != s2[i]: 0010 return s1[:i] 0011 pass 0012 pass 0013 return s1 0014 0015 0016 if __name__ == '__main__': 0017 m = "o one/a one/x one/y one/z".split() 0018 p = commonprefix(m) 0019 print(p) 0020 0021
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|