for file in os.listdir(".."):
if file.endswith(".html"):
print(file)
with open(file, 'r') as f:
for link in BeautifulSoup(f.read(), parse_only=SoupStrainer('a')):
if link.has_attr('href'):
print(link['href'])
我有这个代码,我收到这样的错误
IOError:[Errno 2]没有这样的文件或目录:' quotes-.html'
我在Python DOC中读到The list is in arbitrary order, and does not include the special entries '.' and '..' even if they are present in the directory.
如何以其他方式实现这一点,请有人帮助我