string.find 如果没有,返回-1
read,readlines
image.png
sys.platform,sys.maxsize,sys.version
if sys.platform[:3]=='win':
sys.path
sys.modules
sys.exc_info()
sys.argv
sys.stdin
sys.stdout
sys.stderr
sys.exit()
os.environ
os.system()
os.popen()
os.execv()
os.spawn()
os.fork
os.pipe
os.waitpid
os.kill
os.open
os.pathsep,os.sep,os.pardir,os.curdir,os.linesep
image.png
os.path.abspath()
os.popen(shell).readlines()
import subprocess
subprocess.call(shell) //shell=True
image.png
后台运行
image.png
os.startfile()打开文件
sys.stdin.isatty() 是控制台吗?
重定向输出:
image.png
image.png
os.popen()
image.png
image.png
--
file.seek(0) 回到文件开头
os模块的os.open,os.read,os.write()
image.png
O_EXCL唯一访问权,O_NONBLOCK非阻塞模式
返回文件对象
image.png
os.chmod
os.chown
os.rename
os.remove
os.stat(filename)
image.png
glob.glob(*.py) 文件名模式匹配
os.listdir
os.popen('dir /B').readlines()
遍历目录
image.png
sys.getdefaultencoding()
sys.getfilesystemencoding()