os.path.abspath() |
Path.resolve() |
绝对路径 |
os.chmod() |
Path.chmod() |
|
os.mkdir() |
Path.mkdir() |
创建目录 |
os.rename() |
Path.rename() |
重命名 |
os.replace() |
Path.replace() |
替换 |
os.rmdir() |
Path.rmdir() |
删除目录 |
os.remove() ,os.unlink() |
Path.unlink() |
|
os.getcwd() |
Path.cwd() |
获取当前目录 |
os.path.exists() |
Path.exists() |
判断路径存在 |
os.path.expanduser() |
Path.expanduser() andPath.home() |
|
os.path.isdir() |
Path.is_dir() |
判断目录 |
os.path.isfile() |
Path.is_file() |
判断文件 |
os.path.islink() |
Path.is_symlink() |
|
os.stat() |
Path.stat() ,Path.owner() ,Path.group() |
|
os.path.isabs() |
PurePath.is_absolute() |
判断绝对路径 |
os.path.join() |
PurePath.joinpath() |
拼接路径 |
os.path.basename() |
PurePath.name |
文件名(含后缀) |
os.path.dirname() |
PurePath.parent |
文件目录 |
os.path.samefile() |
Path.samefile() |
|
os.path.splitext() |
PurePath.suffix |
文件后缀 |
|
PurePath.stem |
文件名(不含后缀) |