摘要: shevle:可以用字典存取数据到文件的序列化模块 shevle只有一个open函数,返回类似字典的对象,可读可写;key必须为字符串,而值可以是python所支持的数据类型 # 将序列化文件操作dump与load进行封装s_dic = shelve.open("target_file", writ 阅读全文
posted @ 2019-07-05 22:17 士大夫给力 阅读(151) 评论(0) 推荐(0) 编辑
摘要: shutil模块:高级的 文件、文件夹、压缩包 处理模块 # 基于路径的文件复制:shutil.copyfile('source_file', 'target_file') # 基于流的文件复制:with open('source_file', 'rb') as r, open('target_fi 阅读全文
posted @ 2019-07-05 21:57 士大夫给力 阅读(125) 评论(0) 推荐(0) 编辑
摘要: random:随机数 阅读全文
posted @ 2019-07-05 21:20 士大夫给力 阅读(130) 评论(0) 推荐(0) 编辑
摘要: os:操作系统 在os中提供很多关于文件 , 文件夹 ,路径处理的函数 import os os.path:系统路径操作 import os.path 阅读全文
posted @ 2019-07-05 21:08 士大夫给力 阅读(137) 评论(0) 推荐(0) 编辑
摘要: sys 与解释器相关的一些操作system 代表的不是操作系统而是解释器自己 import sys 阅读全文
posted @ 2019-07-05 21:00 士大夫给力 阅读(116) 评论(0) 推荐(0) 编辑
摘要: time:时间 import time 时间戳(timestamp):time.time()延迟线程的运行:time.sleep(secs)(指定时间戳下的)当前时区时间:time.localtime([secs])(指定时间戳下的)格林威治时间:time.gmtime([secs])(指定时间元组 阅读全文
posted @ 2019-07-05 20:50 士大夫给力 阅读(123) 评论(0) 推荐(0) 编辑