使用 TXT 文本存储

将爬取的数据以 TXT 文本形式存储:

import requests

data = requests.get('http://www.baidu.com/').text

with open('/tmp/1.txt', 'w') as fd:
    fd.write(data)

 

 

 

 

 

 

      

posted @ 2019-03-15 07:10  孔雀东南飞  阅读(180)  评论(0编辑  收藏  举报