Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第五周任务(10-09) #8

Open
will-ww opened this issue Oct 8, 2023 · 1 comment
Open

第五周任务(10-09) #8

will-ww opened this issue Oct 8, 2023 · 1 comment

Comments

@will-ww
Copy link
Contributor

will-ww commented Oct 8, 2023

本周任务如下:

  • 阅读课件
  • 第六章,完成 6.7 实践:Python 网络爬虫,以及课后“践习题” 1~5
  • 第七章,完成 7.5 实践:SQL 数据处理与分析,以及课后“践习题” 1~10
@xxy-0123
Copy link

大家复现“第六章作业内容”中内容时,按照ppt第七页修改后执行scrapy crawl itcast时如果报错
open(filename, 'w').write(response.body)
TypeError: write() argument must be str, not bytes
可以将parse()中的open(filename, 'w').write(response.body)的打开文件方式改成‘wb’,从而将byte输出。
可运行代码:
def parse(self, response):
filename = "teacher .html"
open(filename, 'wb').write(response.body)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants