Re: [問題] 無法成功顯示表特版圖片連結
※ 引述《wsybu (%小步步%)》之銘言:
: ※ 引述《hosayhosay (貓貓)》之銘言:
: : rs=requests.session()
: : rs.post('https://www.ptt.cc/ask/over18', verify=False,data=payload)
: : url='https://www.ptt.cc/bbs/Beauty/index.html'
: : res=rs.get(url,verify=False)
: : print(res.text)
: : soup=BeautifulSoup(res.text,'html.parser')
: : articles= soup.select('div.title a')
: : for art in articles:
: : print(art)
: : res = requests.get('https://www.ptt.cc/bbs'+art['href'])
: 你前面18歲驗證已經放在rs裡面了, 所以你這邊要改成rs.get
: 然後文章網址多了一個bbs路徑
: 所以改成 res = rs.get('https://www.ptt.cc'+art['href'], verify=False)
: 試看看
~~~.謝謝小步步大大您的熱心,我試過以後它顯示錯誤訊息,不知道為什會這樣
以下是錯誤訊息:
Traceback (most recent call last):
File "pttimg6.py", line 1, in <module>
import requests
File "D:\python\requests.py", line 11, in <module>
rs=requests.session()
AttributeError: module 'requests' has no attribute 'session'
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 112.105.240.112 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1571291501.A.984.html
推
10/17 13:53,
5年前
, 1F
10/17 13:53, 1F
推
10/17 16:04,
5年前
, 2F
10/17 16:04, 2F
→
10/17 21:26,
5年前
, 3F
10/17 21:26, 3F
→
10/17 21:29,
5年前
, 4F
10/17 21:29, 4F
→
10/17 22:15,
5年前
, 5F
10/17 22:15, 5F
→
10/17 22:17,
5年前
, 6F
10/17 22:17, 6F
→
10/18 00:27,
5年前
, 7F
10/18 00:27, 7F
→
10/18 00:27,
5年前
, 8F
10/18 00:27, 8F
→
10/18 08:32,
5年前
, 9F
10/18 08:32, 9F
→
10/18 11:03,
5年前
, 10F
10/18 11:03, 10F
→
10/20 07:41,
5年前
, 11F
10/20 07:41, 11F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 3 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章