Skip to content

Commit

Permalink
修改错误
Browse files Browse the repository at this point in the history
  • Loading branch information
qiyeboy committed Jul 13, 2017
1 parent 27db113 commit eb38bab
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 86 deletions.
Binary file added P113.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added P137.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added P145.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added P21.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added P29.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added P58.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions ch01/1.4.4.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ class QueueManager(BaseManager):

'''
taskManager.py程序(Windows版)
'''

#coding:utf-8
# taskManager.py for windows
import Queue
from multiprocessing.managers import BaseManager
from multiprocessing import freeze_support
#任务个数
task_number = 10
#定义收发队列
task_queue = Queue.Queue(task_number);
result_queue = Queue.Queue(task_number);
task_queue = Queue.Queue(task_number)
result_queue = Queue.Queue(task_number)
def get_task():
return task_queue
def get_result():
Expand All @@ -97,7 +97,7 @@ def win_run():
QueueManager.register('get_task_queue',callable = get_task)
QueueManager.register('get_result_queue',callable = get_result)
#绑定端口并设置验证口令,windows下需要填写ip地址,linux下不填默认为本地
manager = QueueManager(address = ('127.0.0.1',8001),authkey = 'qiye')
manager = QueueManager(address = ('127.0.0.1',8001),authkey = b'qiye')
#启动
manager.start()
try:
Expand All @@ -122,4 +122,3 @@ def win_run():
freeze_support()
win_run()

'''
1 change: 1 addition & 0 deletions ch06/DataOutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def store_data(self,data):
def output_html(self):
fout=codecs.open('baike.html','w',encoding='utf-8')
fout.write("<html>")
fout.write("<head><meta charset='utf-8'/></head>")
fout.write("<body>")
fout.write("<table>")
for data in self.datas:
Expand Down
126 changes: 53 additions & 73 deletions ch06/baike.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ch12/cnblogSpider/cnblogSpider/spiders/cnblogs_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse(self, response):
url = paper.xpath(".//*[@class='postTitle']/a/@href").extract()[0]
title = paper.xpath(".//*[@class='postTitle']/a/text()").extract()[0]
time = paper.xpath(".//*[@class='dayTitle']/a/text()").extract()[0]
content = paper.xpath(".//*[@class='postTitle']/a/text()").extract()[0]
content = paper.xpath(".//*[@class='postCon']/a/text()").extract()[0]
item = CnblogspiderItem(url=url, title=title, time=time, content=content)
request = scrapy.Request(url=url, callback=self.parse_body)
request.meta['item'] = item # 将item暂存
Expand Down
4 changes: 2 additions & 2 deletions ch14/zhihuCrawl/zhihuCrawl/spiders/zhihu_com.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def start_login(self,response):
meta={'cookiejar': response.meta['cookiejar']},
formdata={
'_xsrf': self.xsrf,
'phone_num': '15109209327',
'password': '$waqxr123789',
'phone_num': 'xxxxxxxx',
'password': 'xxxxxxxx',
'captcha_type': 'cn'},
callback=self.after_login
)]
Expand Down
66 changes: 61 additions & 5 deletions 勘误表.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
```python
for url in ["ImageUrl_"+str(i) for i in range(10)]:
```
感谢 @jsqlzy
感谢 [@jsqlzy](@jsqlzy)

#### 2. 书籍182页出现问题
原因: 笔误
Expand All @@ -14,7 +14,7 @@ for url in ["ImageUrl_"+str(i) for i in range(10)]:
<br>
将sqlite3改成MySQLdb

感谢 @lg-Cat73
感谢 [@lg-Cat73](@lg-Cat73)

#### 3. 书籍P122-P123 CSS选择器表达式多出空格
原因:印刷错误
Expand All @@ -23,15 +23,15 @@ for url in ["ImageUrl_"+str(i) for i in range(10)]:
<br>
![](123页.png)
<br>
感谢 @Judy0513
感谢 [@Judy0513](@Judy0513)

#### 4. 书籍P144和P156 soup.find_all('a', href = re.compile(r'/view/\d+.htm'))正则表达式有误
原因:百度词条的链接链接结构发生改变,不属于程序错误。
修改如下:
```python
links = soup.find_all('a', href=re.compile(r'/item/.*'))
```
感谢 @Judy0513
感谢 [@Judy0513](@Judy0513)
#### 5.书籍P138页代码有误,多出空格
原因:笔误
<br>
Expand All @@ -40,4 +40,60 @@ links = soup.find_all('a', href=re.compile(r'/item/.*'))
修改如下:
```python
smtp_server = 'smtp.163.com'
```
```
感谢 [@shaodamao](@shaodamao)

#### 6.P58 --表2-4 实现效果第6行,应该是"这些元素拥有值为en的lang属性"
原因:笔误
<br>
![](P58.jpg)
<br>
感谢 [@Judy0513](@Judy0513)

#### 7.P305 def parse_item(self, response), def parse_body(self, response)两个函数排版
原因:排版问题
<br>
感谢 [@Judy0513 ](@Judy0513 )

#### 8.P29,上面那块代码后的文字,任务进程已经编写完成(应该为服务进程)
原因:笔误
<br>
![](P29.jpg)
<br>
感谢 [@wushicanASL](@wushicanASL)

#### 9.P113,倒数第5行 Tag 的content属性 应为Tag的contents属性
原因:笔误
<br>
![](P113.jpg)
<br>
感谢 [@wushicanASL](@wushicanASL)

#### 10. P137 5.3节Email提醒 开始 第三行,发送邮件的协议是STMP(应该为SMTP)
原因:笔误
<br>
![](P137.jpg)
<br>
感谢 [@wushicanASL](@wushicanASL)

#### 11.P145和P152 存储成html,火狐打开出现乱码(其实可以使用火狐可以选择不同的编码)
解决添加如下代码:
<br>
```python
fout.write("<head><meta charset='utf-8'/></head>")
```
![](P145.jpg)
<br>
感谢 [@jsqlzy](@jsqlzy)


#### 12.P21 代码有误
修改为:
```python
p2.terminate()
```
<br>

![](P21.jpg)
<br>
感谢 [@Judy0513 ](@Judy0513 )

0 comments on commit eb38bab

Please sign in to comment.