将爬取的数据以 TXT 文本形式存储:
import requests data = requests.get('http://www.baidu.com/').text with open('/tmp/1.txt', 'w') as fd: fd.write(data)