>  Q&A  >  본문

网页爬虫 - python3 错误“No connection adapters were found for”

python3 版本
检查连接的时候,出现错误“requests.exceptions.InvalidSchema: No connection adapters were found for 'http://oil.cngold.com.cn/2016...'”实在是不知道啥原因?很是奇怪
代码如下:


import requests
from bs4 import BeautifulSoup

filepath = 'E:/links.txt'
with open(filepath,'rb') as f:
    links = f.readlines()

for link in links:
    link = link.strip().decode()
    print(link)
    html = requests.get(link)
    soup = BeautifulSoup(html.text)
    print(soup.title.get_text())

报错信息如下:

阿神阿神2740일 전4129

모든 응답(1)나는 대답할 것이다

  • PHP中文网

    PHP中文网2017-04-18 09:51:39

    이렇게 작동합니다.
    이런 종류의 문제는
    요청: 연결 어댑터를 찾을 수 없습니다. Python3에서 오류가 발생했습니다

    를 참조하세요.

    회신하다
    0
  • 취소회신하다