Python模块之os -系统操作
os
作用:
系统操作
必要操作:
>>> import os
帮助查看:
>>> help(os)
或 单独查看某个方法(函数)
>>> help(os.remove)
方法(函数):
## 删除 china.txt 文件
>>> outfile = "china.txt" >>> os.remove(outfile)
## 查看路径下 china.txt 文件是否存在
outfile = "china.txt" os.path.exists(outfile):
## 打开并读取文件
>>> open("china.txt","a")