一,os模块
1 | os.remove() | 删除文件 |
2 | os.rename() | 重命名文件 |
3 | os.unlink() | 删除文件 |
4 | os.listdir() | 列出指定目录下所有文件 |
5 | os.getcwd() | 获取当前文件路径 |
6 | os.mkdir() | 新建目录 |
7 | os.rmdir() | 删除空目录 |
8 | os.makedirs() | 创建多级目录 |
9 | os.removedirs() | 删除多级目录 |
10 | os.stat(file) | 获取文件属性 |
11 | os.chmod(file) | 修改文件权限 |
12 | os.utime(file) | 修改文件时间戳 |
13 | os.name(file) | 获取操作系统标识 |
14 | os.system() | 执行操作系统命令 |
15 | os.execvp() | 启动一个新进程 |
16 | os.fork() | 获取父进程ID,在子进程返回中返回 |
17 | os.path.split(filename) | 将文件路径和文件名分割 |
18 | os.path.abspath(name) | 获得绝对路径 |
19 | os.path.normpath(path) | 规范path字符串形式 |
20 | os.path.splitunc(path) | 把路径分割为挂载点和文件名 |
21 | os.path.exists() | 判断文件或目录是否存在 |
22 | os.path.realpath(path) | 返回path的真实路径 |
23 | os.path.normcase(path) | 转换path的大小写和斜杠 |
24 | os.path.islink() | 判断文件是否连接文件,返回boolean |
25 | os.path.isfile() | 判断name是不是一个文件,不存在返回false |
26 | os.path.getmti |