- 章节名:8.9. Putting it all together--Example 8.22. The translate function, part 3
- 页码:第118页
其中第二点的解释如下:Because feed maintains an internal buffer, you should always call the parser's close method when you're done (even if you fed it all at once, like you did). Otherwise you may find that your output is missing the last few bytes.关于其中的Otherwise you may find that your output is missing the last few bytes.自己用原文的例子做的实验,将dialect.py中的def translate(url, dialectName="chef"):的 parser.close()那就去掉了,可运行后的return parser.output() 的三个文件没有一个与不注释这句时的效果不一致的,有点儿郁闷,不知道why?这个说的 your output is missing the last few bytes.是如何解释的?先mark一下吧,继续下面的,有结果再回复这里。Ps:我的python是26 是这个原因吗?
参见翻译:http://popexizhi.blogspot.com/2012/08/dive-into-python-xvii.html 的4
没有评论:
发表评论