上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页
摘要: Python_报错:TypeError: write() argument must be str, not int 运行文件写入操作时,报错:TypeError: write() argument must be str, not int 上代码: 运行效果如下: 原因分析:writelines( 阅读全文
posted @ 2018-10-23 22:01 翻滚的小强 阅读(17541) 评论(0) 推荐(0) 编辑
摘要: Python 报错:ValueError: binary mode doesn't take an encoding argument 在运行文件操作相关功能时报错:ValueError: binary mode doesn't take an encoding argument 上代码: 原因分析 阅读全文
posted @ 2018-10-22 22:06 翻滚的小强 阅读(61403) 评论(0) 推荐(1) 编辑
摘要: Python 报错:EOFError: Ran out of input 在运行序列化(pickle)相关功能时报错:EOFError: Ran out of input 上代码: 原因分析:要用文件操作模式打开文件 解决: 改成如下方法即可 阅读全文
posted @ 2018-10-22 21:47 翻滚的小强 阅读(38224) 评论(0) 推荐(0) 编辑
摘要: Python 报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence 在运行序列化(pickle)相关功能时报错:UnicodeDecodeError: ' 阅读全文
posted @ 2018-10-22 21:41 翻滚的小强 阅读(23223) 评论(0) 推荐(1) 编辑
摘要: Python 报错:TypeError: file must have 'read' and 'readline' attributes 在运行序列化(pickle)相关功能时报错:TypeError: file must have 'read' and 'readline' attributes 阅读全文
posted @ 2018-10-22 21:34 翻滚的小强 阅读(8146) 评论(0) 推荐(0) 编辑
摘要: 枚举 说明:给数据加上序号 给加上序号,从0开始的 阅读全文
posted @ 2018-10-18 21:38 翻滚的小强 阅读(272) 评论(0) 推荐(0) 编辑
摘要: 堆栈和队列 (1)堆栈,新放进去的先取出 #encoding=utf-8 (2)队列 队列:按顺序取出 (一)简单应用 s = ["a","b","c","d","e"] s.pop(0) print(s) 阅读全文
posted @ 2018-10-08 18:15 翻滚的小强 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 深拷贝&浅拷贝 #encoding=utf-8import copy a = [1, 2, 3, 4, 5, ['a', 'b']] # 原始对象 b = a # 赋值,传对象的引用 c = copy.copy(a) # 对象拷贝,浅拷贝 d = copy.deepcopy(a) # 对象拷贝,深拷 阅读全文
posted @ 2018-10-08 12:49 翻滚的小强 阅读(93) 评论(0) 推荐(0) 编辑
摘要: 1、迭代器 (1)简单使用 (2)字典的迭代 默认为字典key的迭代: 字典value的迭代: 得到的结果 (3)next迭代器,next的用法 2、生成器 (1) 简单应用 *注意:推导列表和生成器写法的区分 结果如下: (2) yield生成器,相当于next >>> for i in o: . 阅读全文
posted @ 2018-10-08 12:18 翻滚的小强 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 推导列表 1、[表达式 for 变量 in 列表] 2、 [表达式 for 变量 in 列表 if 条件] 阅读全文
posted @ 2018-10-07 22:08 翻滚的小强 阅读(91) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页