MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / basename

Function basename

tools/python-3.11.9-amd64/Lib/posixpath.py:140–145  ·  view source on GitHub ↗

Returns the final component of a pathname

(p)

Source from the content-addressed store, hash-verified

138# Return the tail (basename) part of a path, same as split(path)[1].
139
140def basename(p):
141 """Returns the final component of a pathname"""
142 p = os.fspath(p)
143 sep = _get_sep(p)
144 i = p.rfind(sep) + 1
145 return p[i:]
146
147
148# Return the head (dirname) part of a path, same as split(path)[0].

Callers

nothing calls this directly

Calls 2

_get_sepFunction · 0.85
rfindMethod · 0.80

Tested by

no test coverage detected