Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
8f0fa9e4
Kaydet (Commit)
8f0fa9e4
authored
Mar 19, 1999
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New code for split() by Tim Peters, behaves more like posixpath.split().
üst
d7b5fb85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
40 deletions
+25
-40
dospath.py
Lib/dospath.py
+13
-21
ntpath.py
Lib/ntpath.py
+12
-19
No files found.
Lib/dospath.py
Dosyayı görüntüle @
8f0fa9e4
...
@@ -54,31 +54,23 @@ def splitdrive(p):
...
@@ -54,31 +54,23 @@ def splitdrive(p):
# Split a path in head (everything up to the last '/') and tail (the
# Split a path in head (everything up to the last '/') and tail (the
# rest). If the original path ends in '/' but is not the root, this
# rest). After the trailing '/' is stripped, the invariant
# '/' is stripped. After the trailing '/' is stripped, the invariant
# join(head, tail) == p holds.
# join(head, tail) == p holds.
# The resulting head won't end in '/' unless it is the root.
# The resulting head won't end in '/' unless it is the root.
def
split
(
p
):
def
split
(
p
):
d
,
p
=
splitdrive
(
p
)
d
,
p
=
splitdrive
(
p
)
slashes
=
''
# set i to index beyond p's last slash
while
p
and
p
[
-
1
:]
in
'/
\\
'
:
i
=
len
(
p
)
slashes
=
slashes
+
p
[
-
1
]
while
i
and
p
[
i
-
1
]
not
in
'/
\\
'
:
p
=
p
[:
-
1
]
i
=
i
-
1
if
p
==
''
:
head
,
tail
=
p
[:
i
],
p
[
i
:]
# now tail has no slashes
p
=
p
+
slashes
# remove trailing slashes from head, unless it's all slashes
head
,
tail
=
''
,
''
head2
=
head
for
c
in
p
:
while
head2
and
head2
[
-
1
]
in
'/
\\
'
:
tail
=
tail
+
c
head2
=
head2
[:
-
1
]
if
c
in
'/
\\
'
:
head
=
head2
or
head
head
,
tail
=
head
+
tail
,
''
return
d
+
head
,
tail
slashes
=
''
while
head
and
head
[
-
1
:]
in
'/
\\
'
:
slashes
=
slashes
+
head
[
-
1
]
head
=
head
[:
-
1
]
if
head
==
''
:
head
=
head
+
slashes
return
d
+
head
,
tail
# Split a path in root and extension.
# Split a path in root and extension.
...
...
Lib/ntpath.py
Dosyayı görüntüle @
8f0fa9e4
...
@@ -77,8 +77,7 @@ def splitdrive(p):
...
@@ -77,8 +77,7 @@ def splitdrive(p):
# Split a path in head (everything up to the last '/') and tail (the
# Split a path in head (everything up to the last '/') and tail (the
# rest). If the original path ends in '/' but is not the root, this
# rest). After the trailing '/' is stripped, the invariant
# '/' is stripped. After the trailing '/' is stripped, the invariant
# join(head, tail) == p holds.
# join(head, tail) == p holds.
# The resulting head won't end in '/' unless it is the root.
# The resulting head won't end in '/' unless it is the root.
...
@@ -87,24 +86,18 @@ def split(p):
...
@@ -87,24 +86,18 @@ def split(p):
Return tuple (head, tail) where tail is everything after the final slash.
Return tuple (head, tail) where tail is everything after the final slash.
Either part may be empty."""
Either part may be empty."""
d
,
p
=
splitdrive
(
p
)
d
,
p
=
splitdrive
(
p
)
slashes
=
''
# set i to index beyond p's last slash
while
p
and
p
[
-
1
:]
in
'/
\\
'
:
i
=
len
(
p
)
slashes
=
slashes
+
p
[
-
1
]
while
i
and
p
[
i
-
1
]
not
in
'/
\\
'
:
p
=
p
[:
-
1
]
i
=
i
-
1
if
p
==
''
:
head
,
tail
=
p
[:
i
],
p
[
i
:]
# now tail has no slashes
p
=
p
+
slashes
# remove trailing slashes from head, unless it's all slashes
head
,
tail
=
''
,
''
head2
=
head
for
c
in
p
:
while
head2
and
head2
[
-
1
]
in
'/
\\
'
:
tail
=
tail
+
c
head2
=
head2
[:
-
1
]
if
c
in
'/
\\
'
:
head
=
head2
or
head
head
,
tail
=
head
+
tail
,
''
slashes
=
''
while
head
and
head
[
-
1
:]
in
'/
\\
'
:
slashes
=
slashes
+
head
[
-
1
]
head
=
head
[:
-
1
]
if
head
==
''
:
head
=
head
+
slashes
return
d
+
head
,
tail
return
d
+
head
,
tail
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment