運行Python寫好爬取網上小說的代碼,運行后,提示錯誤:
"""
"""
# 爬取全站小說
# 爬取一本
# 爬取一張
import requests
response = requests.get('http://www.shuquge.com/txt/5809/14765892.html')
print(requests.text)
運行后顯示:
"D:\使用工具\編程\ptyhon 3.6.3\python.exe" D:/使用工具/編程/Python/爬取小說.py
Traceback (most recent call last):
File "D:/使用工具/編程/Python/爬取小說.py", line 8, in <module>
response = requests.get('http://www.shuquge.com/txt/5809/14765892.html')
AttributeError: module 'requests' has no attribute 'get'
行程已結束,退出代碼1
請教各路大神,幫忙解答一下小白的難題,謝謝
uj5u.com熱心網友回復:
response.textuj5u.com熱心網友回復:
看看你的目錄下, 是不是建立一個 requests.py 檔案。uj5u.com熱心網友回復:
它絕對是在同目錄下弄了個和模塊一樣的檔案
uj5u.com熱心網友回復:
哈哈,用Python搭建了request,可以用,但是出現另一個問題:Traceback (most recent call last):
File "D:/安裝好的軟體/編程學習/untitled/first.py", line 9, in <module>
sel = parsel.Selector(response.text)
NameError: name 'parsel' is not defined
uj5u.com熱心網友回復:
在碼的最上面增加了一個:import parsel運行起來就沒問題了,哈哈哈
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/128819.html
下一篇:exec()的相關問題
