Skip to content

Commit d38f533

Browse files
committed
Update yield
1 parent 22ce9c2 commit d38f533

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

yield

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
http://www.ibm.com/developerworks/cn/opensource/os-cn-python-yield/
12
如果直接对文件对象调用 read() 方法,会导致不可预测的内存占用。
23
好的方法是利用固定长度的缓冲区来不断读取文件内容。
34
通过 yield,我们不再需要编写读文件的迭代类,就可以轻松实现文件读取:

0 commit comments

Comments
 (0)