摘要: python中往磁盘存储数据可以采用文件写的方式进行,但采用write函数存储数据时,其数据必须是字符串或二进制数据。如果我们定义了一个类,列表等对象,想要进行存储,那么就必须使用序列化进行存储,采用pickle模块进行格式存储。针对字典的存储,可以采用json模块进行。接下来详细分析pickle的 阅读全文
posted @ 2019-09-04 20:18 fjc0000 阅读(195) 评论(0) 推荐(0) 编辑
摘要: list = (100, 50, 20, 10, 5, 2, 1) result_dict = {} def cache(func): def wrapper(*args): if args in result_dict: return result_dict[args] else: result = f... 阅读全文
posted @ 2019-09-04 19:11 fjc0000 阅读(163) 评论(0) 推荐(0) 编辑