os模块与pathlib中的方法对比
当前位置:首页 > 技术交流
os模块与pathlib中的方法对比

蝈蝈

2022/8/7 21:28:54

os and os.path  pathlib
1 os.path.abspath() Path.resolve()
2 os.chmod() Path.chmod()
3 os.mkdir() Path.mkdir()
4 os.rename() Path.rename()
5 os.replace() Path.replace()
6 os.rmdir() Path.rmdir()
7 os.remove() Path.unlink()
8 os.getcwd() Path.cwd()
9 os.path.exists() Path.exists()
10 os.path.expanduser()     Path.expanduser() and Path.home()
11 os.path.isdir()  Path.is_dir()
12 os.path.isfile() Path.is_file()
13 os.path.islink()   Path.is_symlink()
14 os.stat() Path.stat(),    Path.owner(), Path.group()
15 os.path.isabs()     PurePath.is_absolute()
16 os.path.join() PurePath.joinpath()
17 os.path.basename() PurePath.name
18 os.path.dirname() PurePath.parent
19 os.path.samefile() Path.samefile()
20 os.path.splitext() PurePath.suffix

还可以输入200个字

蝈蝈派【海南省教改项目(Hnjg2022-80)支持】 网站版权所有

Python remained the copyright of our website

吉公网安备 22020402000437号

备案号:吉ICP备2020005062号-2

关注QQ群

了解Python

实时动态