MCPcopy Index your code
hub / github.com/RustPython/RustPython / basename

Function basename

Lib/posixpath.py:166–171  ·  view source on GitHub ↗

Returns the final component of a pathname

(p)

Source from the content-addressed store, hash-verified

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

Calls 2

_get_sepFunction · 0.85
rfindMethod · 0.45