scrapy

1646 단어 python 학습
# -*- coding: utf-8 -*-
import scrapy


class BaiduSpider(scrapy.Spider):
    name = 'baidu'
    allowed_domains = ['baidu.com']
    start_urls = ['http://baidu.com/']

    def parse(self, response):
       # print('    ')
        print(response)
        print(type(response))
      #  print('    ')
        html = str(response.body,encoding="utf8")
        with open("baidu.html","w",encoding="utf8")as f:
            f.write(html)

좋은 웹페이지 즐겨찾기