[Python-checkins] CVS: python/dist/src/Lib ntpath.py,1.26,1.27

Skip Montanaro python-dev@python.org
2000年7月16日 20:07:00 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9825
Modified Files:
	ntpath.py 
Log Message:
* split on / or \
* case insensitive comparison
Index: ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** ntpath.py	2000年07月13日 01:01:03	1.26
--- ntpath.py	2000年07月17日 03:06:58	1.27
***************
*** 9,12 ****
--- 9,13 ----
 import stat
 import string
+ import re
 
 
***************
*** 159,165 ****
 "Given a list of pathnames, returns the longest common leading component"
 if not m: return ''
! n = m[:]
 for i in range(len(n)):
! n[i] = n[i].split(os.sep)
 prefix = n[0]
 for item in n:
--- 160,167 ----
 "Given a list of pathnames, returns the longest common leading component"
 if not m: return ''
! n = map(string.lower, m)
 for i in range(len(n)):
! n[i] = re.split(r"[/\\]", n[i])
! 
 prefix = n[0]
 for item in n:
***************
*** 169,173 ****
 if i == 0: return ''
 break
! return os.sep.join(prefix)
 
 
--- 171,175 ----
 if i == 0: return ''
 break
! return "\\".join(prefix)
 
 

AltStyle によって変換されたページ (->オリジナル) /