1 |
os.access(path, mode) |
Check permission mode |
2 |
os.chdir(path) |
Change current working directory |
3 |
os.chflags(path, flags) |
Set the path's tag to a numeric tag. |
4 |
os.chmod(path, mode) |
Change permissions |
5 |
os.chown(path, uid, gid) |
Change file owner |
6 |
os.chroot(path) |
Change the root directory of the current process |
7 |
os.close(fd) |
Close file descriptor fd |
8 |
os.closerange(fd_low, fd_high) |
Close all file descriptors from fd_low (inclusive) to fd_high (exclusive), errors will be ignored |
9 |
os.dup(fd) |
copy file descriptor fd |
10 |
os.dup2(fd, fd2) |
Copy a file descriptor fd to another fd2 |
11 |
os.fchdir(fd) |
Change the current working directory through a file descriptor |
12 |
os.fchmod(fd, mode) |
Change the access permissions of a file. The file is specified by the parameter fd. The parameter mode is the file access permissions under Unix. |
13 |
os.fchown(fd, uid, gid) |
Modify the ownership of a file. This function modifies the user ID and user group ID of a file specified by the file descriptor fd. |
14 |
os.fdatasync(fd) |
Forces the file specified by file descriptor fd to be written to disk, but does not force the file's status information to be updated. |
15 |
os.fdopen(fd[, mode[, bufsize]]) |
Create a file object through file descriptor fd and return this file object |
16 |
os.fpathconf(fd, name) |
Returns system configuration information for an open file. name is the value of the system configuration being retrieved, which may be a string that defines a system value. These names are specified in many standards (POSIX.1, Unix 95, Unix 98, and others). |
17 |
os.fstat(fd) |
Returns the status of file descriptor fd, like stat(). |
18 |
os.fstatvfs(fd) |
Returns file system information for the file containing file descriptor fd, like statvfs() |
19 |
os.fsync(fd) |
Force the file with file descriptor fd to be written to the hard disk. |
20 |
os.ftruncate(fd, length) |
Crop the file corresponding to file descriptor fd, so it cannot exceed the maximum file size. |
21 |
os.getcwd() |
Return to current working directory |
22 |
os.getcwdu() |
Returns a Unicode object of the current working directory |
23 |
os.isatty(fd) |
If the file descriptor fd is open and connected to a tty (-like) device, returns true, otherwise False. |
24 |
os.lchflags(path, flags) |
Set the path flag to a numeric flag, similar to chflags(), but without soft links |
25 |
os.lchmod(path, mode) |
Modify connection file permissions |
26 |
os.lchown(path, uid, gid) |
Change the file owner, similar to chown, but does not follow the link. |
27 |
os.link(src, dst) |
Create a hard link named parameter dst pointing to parameter src |
28 |
os.listdir(path) |
Returns a list of the names of files or folders contained in the folder specified by path. |
29 |
os.lseek(fd, pos, how) |
Set the current position of the file descriptor fd to pos, how to modify it: SEEK_SET or 0 sets the pos calculated from the beginning of the file; SEEK_CUR or 1 calculates from the current position; os.SEEK_END or 2 starts from the end of the file. In Unix, Windows Moderately effective |
30 |
os.lstat(path) |
Like stat(), but without soft links |
31 |
os.major(device) |
Extract the device major number from the original device number (using the st_dev or st_rdev field in stat). |
32 |
os.makedev(major, minor) |
Use the major and minor device numbers to form an original device number |
33 |
os.makedirs(path[, mode]) |
Recursive folder creation function. Like mkdir(), but all intermediate-level folders created need to contain subfolders. |
34 |
os.minor(device) |
从原始的设备号中提取设备minor号码 (使用stat中的st_dev或者st_rdev field )。 |
35 |
os.mkdir(path[, mode]) |
以数字mode的mode创建一个名为path的文件夹.默认的 mode 是 0777 (八进制)。 |
36 |
os.mkfifo(path[, mode]) |
创建命名管道,mode 为数字,默认为 0666 (八进制) |
37 |
os.mknod(filename[, mode=0600, device]) |
创建一个名为filename文件系统节点(文件,设备特别文件或者命名pipe)。 |
38 |
os.open(file, flags[, mode]) |
打开一个文件,并且设置需要的打开选项,mode参数是可选的 |
39 |
os.openpty() |
打开一个新的伪终端对。返回 pty 和 tty的文件描述符。 |
40 |
os.pathconf(path, name) |
返回相关文件的系统配置信息。 |
41 |
os.pipe() |
创建一个管道. 返回一对文件描述符(r, w) 分别为读和写 |
42 |
os.popen(command[, mode[, bufsize]]) |
从一个 command 打开一个管道 |
43 |
os.read(fd, n) |
从文件描述符 fd 中读取最多 n 个字节,返回包含读取字节的字符串,文件描述符 fd对应文件已达到结尾, 返回一个空字符串。 |
44 |
os.readlink(path) |
返回软链接所指向的文件 |
45 |
os.remove(path) |
删除路径为path的文件。如果path 是一个文件夹,将抛出OSError; 查看下面的rmdir()删除一个 directory。 |
46 |
os.removedirs(path) |
递归删除目录。 |
47 |
os.rename(src, dst) |
重命名文件或目录,从 src 到 dst |
48 |
os.renames(old, new) |
递归地对目录进行更名,也可以对文件进行更名。 |
49 |
os.rmdir(path) |
删除path指定的空目录,如果目录非空,则抛出一个OSError异常。 |
50 |
os.stat(path) |
获取path指定的路径的信息,功能等同于C API中的stat()系统调用。 |
51 |
os.stat_float_times([newvalue]) |
决定stat_result是否以float对象显示时间戳 |
52 |
os.statvfs(path) |
获取指定路径的文件系统统计信息 |
53 |
os.symlink(src, dst) |
创建一个软链接 |
54 |
os.tcgetpgrp(fd) |
返回与终端fd(一个由os.open()返回的打开的文件描述符)关联的进程组 |
55 |
os.tcsetpgrp(fd, pg) |
设置与终端fd(一个由os.open()返回的打开的文件描述符)关联的进程组为pg。 |
56 |
os.tempnam([dir[, prefix]]) |
返回唯一的路径名用于创建临时文件。 |
57 |
os.tmpfile() |
返回一个打开的模式为(w+b)的文件对象 .这文件对象没有文件夹入口,没有文件描述符,将会自动删除。 |
58 |
os.tmpnam() |
为创建一个临时文件返回一个唯一的路径 |
59 |
os.ttyname(fd) |
返回一个字符串,它表示与文件描述符fd 关联的终端设备。如果fd 没有与终端设备关联,则引发一个异常。 |
60 |
os.unlink(path) |
删除文件 |
61 |
os.utime(path, times) |
返回指定的path文件的访问和修改的时间。 |
62 |
os.walk(top[, topdown=True[, οnerrοr=None[, followlinks=False]]]) |
输出在文件夹中的文件名通过在树中游走,向上或者向下。 |
63 |
os.write(fd, str) |
写入字符串到文件描述符 fd中. 返回实际写入的字符串长度 |