使用 TXT 文本存储

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

import requests

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

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

      

猜你喜欢

转载自www.cnblogs.com/pzk7788/p/10534715.html