1 #百度的关键词接口:http://www.baidu.com/s?wd=keyword 2 #360的关键词接口:http://www.so.com/s?q=keyword 3 import requests 4 keyword="python" 5 try: 6 kv={'wd':keyword} 7 r=requests.get("http://www.baidu.com/s",params=kv) 8 print(r.request.url) 9 r.raise_for_status() 10 print(len(r.text)) 11 except: 12 print("爬取失败")--------------------------------------------------