当前位置:网站首页>【os.path】的相关用法(持更)
【os.path】的相关用法(持更)
2022-08-08 13:34:00 【panbaoran913】
01、‘abspath’,
02、 ‘altsep’,
03、 basename
返回文件路径中的最后的文件名,如果以/
结尾,则返回None
04、 ‘commonpath’,
05、 ‘commonprefix’,
06、 ‘curdir’,
07、 ‘defpath’,
08、 ‘devnull’,
09、 dirname
,
返回去掉文件名的路径
10、 ‘exists’, 判断路径是否存在
11、 ‘expanduser’,
12、 ‘expandvars’,
13、 ‘extsep’,
14、 ‘genericpath’,
15、 ‘getatime’,
16、 ‘getctime’,
17、 ‘getmtime’,
17、 ‘getsize’,
19、 ‘isabs’,
20 、 ‘isdir’,
21、 ‘isfile’,
22、 ‘islink’,
23、 ‘ismount’,
24、 join
,
路径拼接,注意事项:
- 可拼接2个或着多个路径,第一个称为初始路径,如果各组件名首字母不包含
/
或\
,则函数会自动加上\
。提醒,如果利用自动加入的话,/
和\
是不统一的。- 初始路径可识别的符号,
字符串 识别后的 ./data
./data
/data
/data
\\data
\data
\data
\data
3. 如果拼接在后的参数中含有’‘开头的参数,将从’'开头的参数开始,前面的参数均将失效
3.如果最后一个组件为空,则生成的路径以一个\
分隔符结尾
25、 ‘lexists’,
26、 ‘normcase’,
27、 ‘normpath’,
28 、 ‘os’,
29、 ‘pardir’,
30、 ‘pathsep’,
31、 ‘realpath’,
32、 ‘relpath’,
33、 ‘samefile’,
34、 ‘sameopenfile’,
35、 ‘samestat’,
36、 ‘sep’,
37、 ‘split’,
38、 ‘splitdrive’,
39、 ‘splitext’,
40、 ‘stat’,
41、 ‘supports_unicode_filenames’,
42、 ‘sys’
边栏推荐
猜你喜欢
Jenkins - Introduction to Continuous Integration (1)
金融行业数智化供应链管理系统:多维度评估分析供应商,赋能智能金融变革
【第2天】SQL快速入门-条件查询(SQL 小虚竹)
textarea 禁止拖拽
The programmer essential VS debugging technique
C语言小项目 -- 扫雷游戏完整代码(递归展开 + 选择标记)
Knowledge points and written test questions related to shift operations, bit operations, and logical operations
深入浅出对话系统——任务型对话系统技术框架
HackTheBox | Horizontall
Doris学习笔记之优化
随机推荐
活动报名| StreamNative 受邀参与 ITPUB 在线技术沙龙
【低代码】1405- 浅谈低代码平台远程组件加载方案
Three classic topics in C language: three-step flip method, Young's matrix, and tossing and dividing method
sample函数—R语言
R语言ggplot2可视化:使用ggpubr包的ggdonutchart函数可视化甜甜圈图(donut chart)、为甜甜圈图添加自定义标签(包含文本内容以及数值百分比)、lab.font参数设置标
idea中项目呈现树形结构
HackTheBox | Horizontall
serialize serialize native method
Qt操作Sqlite类封装,及命令行导入csv文件到Sqlite数据库
一桩事先张扬的网红书店倒闭案
移位运算、位运算、逻辑运算相关知识点及笔试题
Flink1.15源码阅读——StreamGraph流图
使用.NET简单实现一个Redis的高性能克隆版(三)
[Redis] Redis installation and use of client redis-cli (batch operation)
PC端实用软件推荐
serialize 序列化原生方法
暗恋云匹配匿名交友聊天系统开发
KD-SCFNet:通过知识蒸馏实现更准确、更高效的显着目标检测(ECCV2022)
Using Flask and Celery to push real-time/timed messages asynchronously in Win10 environment (Socket.io)/The latest strategy in 2020
MySQL:锁机制 |表级锁、行级锁 | 排它锁、共享锁 | 间隙锁