使用surrogateescape进行转换,这里边整个路径都转换完毕,可以切分取其中中文
label = path.encode(‘utf-8’, ‘surrogateescape’).decode(‘utf-8’).split(’/’)[-2]
使用surrogateescape进行转换,这里边整个路径都转换完毕,可以切分取其中中文
label = path.encode(‘utf-8’, ‘surrogateescape’).decode(‘utf-8’).split(’/’)[-2]