博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
shelve模块(* * *)
阅读量:4672 次
发布时间:2019-06-09

本文共 375 字,大约阅读时间需要 1 分钟。

shelve模块比pickle模块简单,只有一个open函数,返回类似字典的对象,可读可写;key必须为字符串,而值可以是python所支持的数据类型

import shelve f = shelve.open(r'shelve.txt') # f['stu1_info']={'name':'alex','age':'18'}# f['stu2_info']={'name':'alvin','age':'20'}# f['school_info']={'website':'oldboyedu.com','city':'beijing'}### f.close() print(f.get('stu_info')['age'])

  

转载于:https://www.cnblogs.com/Mengchangxin/p/9304780.html

你可能感兴趣的文章
Spring(3)
查看>>
SSM整合 mybatis多条件查询与分页
查看>>
VS2010中dumpbin工具的使用
查看>>
使用Golang搭建web服务
查看>>
HTML5触摸事件(touchstart、touchmove和touchend)
查看>>
架构师软技能之协商(上)
查看>>
商品翻牌效果(纯css)
查看>>
win10 UWP 序列化
查看>>
读书心得
查看>>
前端知识整理 CSS盒模型
查看>>
sendmail 常见报错总结
查看>>
asp.net Response.AddHeader的方法来下载
查看>>
neo4j-访问提示No authorization header supplied.
查看>>
android-activity生命周期方法
查看>>
基于贪心算法的几类区间覆盖问题 nyoj 12喷水装置(二) nyoj 14会场安排问题...
查看>>
web之JavaScript
查看>>
HTML input 控件
查看>>
MongoDB副本集配置系列六:定位MongoDB慢的原因
查看>>
[EGORefreshTableHeaderView]手动启动下拉更新的方法
查看>>
Linux磁盘分区/格式化/挂载目录
查看>>