摘要: f = open('users.txt',encoding='utf-8') #读文件的时候,必须存在在才可以读 文件对象,或者文件句柄res = f.read()print(res)f.close() fw = open('users',mode='a',encoding='utf-8')fw.w 阅读全文
posted @ 2018-11-19 23:02 狐觞 阅读(198) 评论(0) 推荐(0) 编辑
摘要: s='.abc.abc.BCD,abc'# new_s = s.strip('.') #默认去掉字符串两边的空格和换行符# print(s.rstrip()) #去掉右边的# print(s.lstrip()) #去掉左边# print(s.count('.')) #某个字符串出现的次数# prin 阅读全文
posted @ 2018-11-19 22:24 狐觞 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 一.字典 stu_info = {"name": "王志华", "age": 18, "addr": "北京"}# key - value# 1.查# print(stu_info)# print(stu_info['name'])# print(stu_info['age'])# print(st 阅读全文
posted @ 2018-11-19 14:37 狐觞 阅读(182) 评论(0) 推荐(0) 编辑