Python BeautifulSoup找不到任何<;a>;标签

Python BeautifulSoup找不到任何<;a>;标签,python,beautifulsoup,Python,Beautifulsoup,我正试图在这里抓取网站:。使用如下所示的代码: from bs4 import BeautifulSoup import urllib.request html = urllib.request.urlopen("ftp://ftp.sec.gov/edgar/daily-index/") soup = BeautifulSoup(line, "lxml") soup.a # or soup.find_all('a') neither of them works #return None.

我正试图在这里抓取网站:。使用如下所示的代码:

from bs4 import BeautifulSoup  
import urllib.request
html = urllib.request.urlopen("ftp://ftp.sec.gov/edgar/daily-index/")
soup = BeautifulSoup(line, "lxml")
soup.a # or soup.find_all('a') neither of them works
#return None.

请帮忙,我真的很沮丧。我怀疑是标签引起了问题。该网站的Html看起来格式良好(匹配的标签),所以我不明白为什么BeautifulSoup找不到任何东西。谢谢这
ftp://ftp.sec.gov/edgar/daily-index/
URL指向FTP目录,而不是HTML页面

您的浏览器可以根据FTP目录内容生成HTML,但当您使用
urllib.request
加载该资源时,服务器不会向您发送HTML


您可能希望直接使用来读取目录列表,或者首先检查
urlopen(…).read()的返回值。

是什么让您认为您从该URL获得了HTML?