我的档案就像这样。
label0/index.jpeg 0
label1/index.jpeg 1
我的代码是
def add_ext_name(cls, path, ext_name):
name, ext = os.path.splitext(os.path.basename(path))
added = os.path.join(os.path.dirname(path), name + ext_name + ext)
return added
错误是
def basename(p):
"""Returns the final component of a pathname"""
p = os.fspath(p)
sep = _get_sep(p)
i = p.rfind(sep) + 1
TypeError: expected str, bytes or os.PathLike object, not ImageProperty
我在哪里弄错了?