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
384d2490
Kaydet (Commit)
384d2490
authored
Şub 18, 1997
tarafından
Barry Warsaw
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
join(): join one or more path components
üst
736bb065
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
26 deletions
+42
-26
macpath.py
Lib/macpath.py
+18
-12
ntpath.py
Lib/ntpath.py
+12
-7
posixpath.py
Lib/posixpath.py
+12
-7
No files found.
Lib/macpath.py
Dosyayı görüntüle @
384d2490
...
...
@@ -20,18 +20,24 @@ def isabs(s):
return
':'
in
s
and
s
[
0
]
<>
':'
# Join two pathnames.
# The result is equivalent to what the second pathname would refer to
# if the first pathname were the current directory.
def
join
(
s
,
t
):
if
(
not
s
)
or
isabs
(
t
):
return
t
if
t
[:
1
]
==
':'
:
t
=
t
[
1
:]
if
':'
not
in
s
:
s
=
':'
+
s
if
s
[
-
1
:]
<>
':'
:
s
=
s
+
':'
return
s
+
t
# Join pathnames.
# Ignore the previous parts if a part is absolute.
# Insert a '/' unless the first part is empty or already ends in '/'.
def
join
(
s
,
*
p
):
path
=
s
for
t
in
p
:
if
(
not
s
)
or
isabs
(
t
):
path
=
t
continue
if
t
[:
1
]
==
':'
:
t
=
t
[
1
:]
if
':'
not
in
path
:
path
=
':'
+
path
if
path
[
-
1
:]
<>
':'
:
path
=
path
+
':'
path
=
path
+
t
return
path
# Split a pathname in two parts: the directory leading up to the final bit,
...
...
Lib/ntpath.py
Dosyayı görüntüle @
384d2490
...
...
@@ -34,15 +34,20 @@ def isabs(s):
return
s
!=
''
and
s
[:
1
]
in
'/
\\
'
# Join
two
pathnames.
# Ignore the
first part if the second
part is absolute.
# Join pathnames.
# Ignore the
previous parts if a
part is absolute.
# Insert a '/' unless the first part is empty or already ends in '/'.
def
join
(
a
,
b
):
if
isabs
(
b
):
return
b
if
a
==
''
or
a
[
-
1
:]
in
'/
\\
'
:
return
a
+
b
# Note: join('x', '') returns 'x/'; is this what we want?
return
a
+
os
.
sep
+
b
def
join
(
a
,
*
p
):
path
=
a
for
b
in
p
:
if
isabs
(
b
):
path
=
b
elif
path
==
''
or
path
[
-
1
:]
in
'/
\\
'
:
path
=
path
+
b
else
:
path
=
path
+
os
.
sep
+
b
return
path
# Split a path in a drive specification (a drive letter followed by a
...
...
Lib/posixpath.py
Dosyayı görüntüle @
384d2490
...
...
@@ -26,15 +26,20 @@ def isabs(s):
return
s
[:
1
]
==
'/'
# Join
two
pathnames.
# Ignore the
first part if the second
part is absolute.
# Join pathnames.
# Ignore the
previous parts if a
part is absolute.
# Insert a '/' unless the first part is empty or already ends in '/'.
def
join
(
a
,
b
):
if
b
[:
1
]
==
'/'
:
return
b
if
a
==
''
or
a
[
-
1
:]
==
'/'
:
return
a
+
b
# Note: join('x', '') returns 'x/'; is this what we want?
return
a
+
'/'
+
b
def
join
(
a
,
*
p
):
path
=
a
for
b
in
p
:
if
b
[:
1
]
==
'/'
:
path
=
b
elif
path
==
''
or
path
[
-
1
:]
==
'/'
:
path
=
path
+
b
else
:
path
=
path
+
'/'
+
b
return
path
# Split a path in head (everything up to the last '/') and tail (the
...
...
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