我正在尝试用BeautifulSoup创建一个表格抓取。我写了这段Python代码:
import urllib2
from bs4 import BeautifulSoup
url = "http://dofollow.netsons.org/table1.htm" # change to whatever your url is
page = urllib2.urlopen(url).read()
soup = BeautifulSoup(page)
for i in soup.find_all('form'):
print i.attrs[
我一直试图使用Python中的Beautifulsoup来抓取一些图像,而且我面临一些问题,所以问题是,我能够成功地刮掉链接,并将其存储在文件夹中,但是图像是不受支持的格式。
res = requests.get('https://books.toscrape.com/')
res.raise_for_status()
file = open('op.html', 'wb')
for i in res.iter_content(10000):
file.write(i)
os.makedirs('images'
我用g拇指编辑了一个GIF图像(没有动画),在试图保存时遇到了以下错误:
Could not save the file
Could not find a suitable module to save the image as "image/gif"
我跳到首选项上,却发现GIF不存在时可以保存。只有JPG,PNG,TIFF,TGA,WebP。
有什么方法可以将图像保存为GIF而不将其转换成其他格式呢?