chdir

修改当前工作目录到指定目录
Change the current working directory to the specified path.

chmod

修改一个文件的访问权限
Change the access permissions of a file.

chown

把一个目录的属主和属组修改成另一个数字的属主和属组
Change the owner and group id of path to the numeric uid and gid

chroot

修改根目录(在liunx下使用)
Change root directory to path.

ctermid

返回一个进程的控制台的名字
Return the name of the controlling terminal for this process.

getcwd

以字符串格式显示当前工作目录(python解释器的工作目录)
Return a unicode string representing the current working directory.

getegid

获取当前进程的有效组ID
Return the current process's effective group id.

getenv

获取系统的环境变量,环境变量不存在时返回None
Get an environment variable, return None if it doesn't exist.

geteuid

获取当前进程的有效用户ID
Return the current process's effective user id.

getgid

获取当彰进程的组ID
Return the current process's group id.

getgrouplist

返回指定用户的基本组的列表
getgrouplist(user, group) -> list of groups to which a user belongs
Returns a list of groups to which a user belongs.

getgroups

获取一个进程的附加组ID的列表
Return list of supplemental group IDs for the process.

getloadavg

返回当前一个由系统1分钟,5分钟和15分钟的平均负载使用率组成的元组
Return average recent system load information.
Return the number of processes in the system run queue averaged over
the last 1, 5, and 15 minutes as a tuple of three floats.
Raises OSError if the load average was unobtainable.

getlogin

返回当前系统的实际登陆的用户名
Return the actual login name.

getpid

返回当前的进程ID号
Return the current process id.

getppid

返回当前进程的父进程的ID号
Return the parent's process id.

getuid

返回当前进程的用户ID
Return the current process's user id.

kill

结束一个进程
Kill a process with a signal.

killpg

结束掉一个进程组
Kill a process group with a signal.

listdir

返回指定路径下由所有所有文件的名字组成的列表,未指定路径则默认为当前路径
Return a list containing the names of the files in the directory.
path can be specified as either str or bytes. If path is bytes,
the filenames returned will also be bytes; in all other circumstances
the filenames returned will be str.
If path is None, uses the path='.'.

lseek

设置并返回指定文件的指针的位置,
Set the position of a file descriptor. Return the new position.
Return the new cursor position in number of bytes
relative to the beginning of the file.

major

获取一个设备文件的主设备号
Extracts a device major number from a raw device number.

makedev

在系统上创建一个新的设备文件
Composes a raw device number from the major and minor device numbers.

makedirs

递归创建多层目录,如果目标目录已经存在,则报错
Super-mkdir; create a leaf directory and all intermediate ones. Works like
mkdir, except that any intermediate path segment (not just the rightmost)
will be created if it does not exist. If the target directory already
exists, raise an OSError if exist_ok is False. Otherwise no exception is
raised. This is recursive.

minor

获取一个设备文件的次设备号
Extracts a device minor number from a raw device number.

mkdir

创建一个目录
Create a directory.

mkfifo

创建一个管道文件
If dir_fd is not None, it should be a file descriptor open to a directory,
and path should be relative; path will then be relative to that directory.
dir_fd may not be implemented on your platform.
If it is unavailable, using it will raise a NotImplementedError.

nice

为一个进程增加属性,也即修改一个进程的nice值
Add increment to the priority of process and return the new priority.

open

在硬件层面打开文件,返回一个整型的文件描述符
Open a file for low level IO. Returns a file descriptor (integer).

putenv

修改或增加一个环境变量
Change or add an environment variable.

read

读取指定文件的文件描述符,返回字节对象
Read from a file descriptor. Returns a bytes object.

remove

删除指定文件
Remove a file (same as unlink()).

removedirs

删除多层目录,
Super-rmdir; remove a leaf directory and all empty intermediate
ones. Works like rmdir except that, if the leaf directory is
successfully removed, directories corresponding to rightmost path
segments will be pruned away until either the whole path is
consumed or an error occurs. Errors during this latter phase are
ignored -- they generally mean that a directory was not empty.

rename

为一个文件或目录重命名
Rename a file or directory.

rmdir

删除一个目录
Remove a directory.

setegid

设置当前进程的有效组ID
Set the current process's effective group id.

seteuid

设置当前进程的有效用户ID
Set the current process's effective user id.

setgid

设置当前进程的组ID
Set the current process's group id.

setuid

为当前进程设置用户ID
Set the current process's user id.

stat

显示指定路径的详细信息
Perform a stat system call on the given path.

strerror

把错误号码转换成信息字符串
Translate an error code to a message string.

symlink

为指定目录创建软链接
symlink(src, dst, target_is_directory=False, *, dir_fd=None)
Create a symbolic link pointing to src named dst.

sync

强制写入内容到磁盘中
Force write of everything to disk.

system

在子shell中执行系统命令
Execute the command in a subshell.

times

返回系统时间信息的集合
Return a collection containing process timing information.

umask

为文件或目录设置并返回新权限模式
Set the current numeric umask and return the previous umask.

uname

返回当前操作系统的内核信息
Return an object identifying the current operating system.

unlink

删除一个软链接
unlink(path, *, dir_fd=None)
Remove a file (same as remove()).

unsetenv

删除一个环境变量
Delete an environment variable.

utime

为指定路径设置最后访问时间和最后修改时间
utime(path, times=None, *, ns=None, dir_fd=None, follow_symlinks=True)
Set the access and modified time of path.

walk

给定目录名,返回一个由当前目录名,当前目录的子目录以及当前目录下的普通文件组成的元组
Directory tree generator.
For each directory in the directory tree rooted at top (including top
itself, but excluding '.' and '..'), yields a 3-tuple
dirpath, dirnames, filenames
dirpath is a string, the path to the directory. dirnames is a list of
the names of the subdirectories in dirpath (excluding '.' and '..').
filenames is a list of the names of the non-directory files in dirpath.
Note that the names in the lists are just names, with no path components.
To get a full path (which begins with top) to a file or directory in
dirpath, do os.path.join(dirpath, name).

OS模块的常用内置方法的更多相关文章

  1. python字符串常用内置方法

    python字符串常用内置方法 定义: 字符串是一个有序的字符的集合,用与存储和表示基本的文本信息. python中引号中间包含的就是字符串. # s1='hello world' # s2=&quo ...

  2. python迭代器-迭代器取值-for循环-生成器-yield-生成器表达式-常用内置方法-面向过程编程-05

    迭代器 迭代器 迭代: # 更新换代(其实也是重复)的过程,每一次的迭代都必须基于上一次的结果(上一次与这一次之间必须是有关系的) 迭代器: # 迭代取值的工具 为什么用迭代器: # 迭代器提供了一种 ...

  3. 迭代器,for循环本质,生成器,常用内置方法,面向过程编程

    一.迭代器 1.迭代:更新换代(重复)的过程,每次的迭代都必须基于上一次的结果 迭代器:迭代取值的工具 2.迭代器给你提供了一种不依赖于索引取值的方式 3.可以迭代取值的对象:字符串,列表,元组,字典 ...

  4. Python常用模块中常用内置函数的具体介绍

    Python作为计算机语言中常用的语言,它具有十分强大的功能,但是你知道Python常用模块I的内置模块中常用内置函数都包括哪些具体的函数吗?以下的文章就是对Python常用模块I的内置模块的常用内置 ...

  5. Python 类的常用内置方法

    类的内置方法(魔法方法): 凡是在类内部定义,以__开头__结尾的方法,都是类的内置方法,类的内置方法,会在满足某种条件下自动触发. 1.1__new__ __new__:在___init__触发前, ...

  6. python基础操作以及其常用内置方法

    #可变类型: 值变了,但是id没有变,证明没有生成新的值而是在改变原值,原值是可变类型#不可变类型:值变了,id也跟着变,证明是生成了新的值而不是在改变原值,原值是不可变 # x=10# print( ...

  7. 递归,装饰器,python常用内置方法

    **递归**        def calc(n):            print(n)            if int(n / 2) == 0:  条件判断                r ...

  8. JavaScript基础 -- js常用内置方法和对象

    JS中常用的内置函数如下: 1.eval(str):计算表达式的结果. 2.parseInt(str,n):将符串转换成整数数字形式(可指定几进制). 3.parseFloat(str):将字符串转换 ...

  9. python常用内置方法

    常用内建函数# 如何在遍历一个列表的同时获取当前下标? # 普通人的做法 list = [1, 2, 3, 4, 5, 6] index = 0 for i in list: print('下标%s' ...

随机推荐

  1. 新安装的soapui启动时报错及解决方法

    今天新安装了soapui准备测试一下接口,结果安装成功后启动时报错:The JVM could not be started. The maximum heap size (-Xmx) might b ...

  2. 谈谈Grunt,NPM,Gulp

    随着前端工程化的趋势,产生了越来越多的构建工具,而其中比较优秀的就是grunt,npm,gulp,今天我来说说这三者间的区别以及他们的优缺点. 相信一般前端开发者选择构建工具的时候,更多的是看个人习惯 ...

  3. 2017ecjtu-summer training #2 CodeForces 608B

    B. Hamming Distance Sum time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. Frame Stacking(拓扑排序)

    题目链接:http://acm.tju.edu.cn/toj/showp1076.html1076.   Frame Stacking Time Limit: 1.0 Seconds   Memory ...

  5. c++(线性结构的处理)

    我们知道,在内存中的空间都是连续的.也就是说,0x00000001下面的地址必然是0x00000002.所以,空间上是不会出现地址的突变的.那什么数据结构类型是连续内部空间呢,其实就是数组,当然也可以 ...

  6. 解决JSONObject.fromObject数字为null时被转换为0

    在使用JSONObject.fromObject的时候会遇到一种情况就是当对象的某一个Double型或Integer型的属性为空的时候,转JSON的时候会变成0.当一个布尔型的属性为空的时候,转JSO ...

  7. Newbit 启用淘宝店域名

    自2016-10-19起,我们正式启用淘宝店的域名,newbit.taobao.com 店里提供所有课程当中用到硬件,ZigBee插件/贴片模块等, 我们将坚持给大家提供最具扩展性,最方便使用的开发工 ...

  8. PHP安全之webshell和后门检测

    基于PHP的应用面临着各种各样的攻击: XSS:对PHP的Web应用而言,跨站脚本是一个易受攻击的点.攻击者可以利用它盗取用户信息.你可以配置Apache,或是写更安全的PHP代码(验证所有用户输入) ...

  9. Oracle_group by分组查询_深入

    Oracle_group by分组查询_深入 本文导读:在实际SQL应用中,经常需要进行分组聚合,即将查询对象按一定条件分组,然后对每一个组进行聚合分析.                    创建分 ...

  10. svn冲突文件解决方法

    svn冲突文件解决方法 工具/原料 svn客户端 方法/步骤 1 通过SVN客户端更新需要的文件,如果出现有感叹号的文件,找到出现感叹号的文件. 2 选择感叹号文件,即冲突文件,单击鼠标右键对冲突文件 ...