MCPcopy Index your code
hub / github.com/python/cpython / basename

Function basename

Lib/posixpath.py:167–172  ·  view source on GitHub ↗

Returns the final component of a pathname

(p, /)

Source from the content-addressed store, hash-verified

165# Return the tail (basename) part of a path, same as split(path)[1].
166
167def basename(p, /):
168 """Returns the final component of a pathname"""
169 p = os.fspath(p)
170 sep = _get_sep(p)
171 i = p.rfind(sep) + 1
172 return p[i:]
173
174
175# Return the head (dirname) part of a path, same as split(path)[0].

Calls 2

_get_sepFunction · 0.85
rfindMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…