摘要: shutil模块 高级的文件,文件夹,压缩包处理模块 常用方法 1、 shutil.copyfileobj(fsrc, fdst[, length]) 将文件内容拷贝到另一个文件中 2、 shutil.copyfile(src, dst) 拷贝文件 3、 shutil.copymode(src, d 阅读全文
posted @ 2020-05-20 23:48 静心&得意 阅读(159) 评论(0) 推荐(0) 编辑
摘要: sys 系统相关的参数和函数 常用方法 1、 sys.argv 获取命令行参数,返回值是List,第一个元素是程序本身 结果: linux ko5m:/home/python/test ./test.py 1 2 3 ./test.py 1 2 3 2、 sys.exit(n) 程序退出,如果是正常 阅读全文
posted @ 2020-05-20 23:37 静心&得意 阅读(164) 评论(0) 推荐(0) 编辑
摘要: os.path 常见路径操作 常用方法: 1、 os.path.abspath(path) 返回绝对路径 2、 os.path.basename(path) 返回文件名 3、 os.path.commonprefix(list) 返回list(多个路径)中,所有path共有的最长的路径 4、 os. 阅读全文
posted @ 2020-05-20 23:30 静心&得意 阅读(257) 评论(0) 推荐(0) 编辑
摘要: os -- 操作系统接口模块 OS模块提供了一些方便使用操作系统相关的函数 常用方法: 1、os.name --获取操作系统平台 >>> os.name 'posix' 2、os.getcwd() --获取当前工作目录 >>> os.getcwd() '/home/test' 3、os.chdir( 阅读全文
posted @ 2020-05-20 23:14 静心&得意 阅读(147) 评论(0) 推荐(0) 编辑