是否可以使用openpyxl插入图像(jpeg,png等)?
基本上我想放置一个生成的图像,下面有一个图表.
我没有在文档中看到任何内容,与代码的成熟度相比,这似乎有点缺乏.
我正在尝试将图像大小调整为500x500px但出现此错误:
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1681, in save
save_handler = SAVE[format.upper()] KeyError: 'JPG'
Run Code Online (Sandbox Code Playgroud)
这是代码:
from PIL import Image
img = Image.open('car.jpg')
new_img = img.resize((500,500))
new_img.save('car_resized','jpg')
Run Code Online (Sandbox Code Playgroud) 我正在尝试从URL中抓取表格
我可以使用 Scrapestorm 工具抓取表格数据。我是 python 新手,无法从此URL获取数据。
from bs4 import BeautifulSoup
page = requests.get('https://pantheon.world/explore/rankings?show=people&years=-3501,2020')
soup = BeautifulSoup(page.text)
Run Code Online (Sandbox Code Playgroud)
Excel 中所需的输出:

是否可以从网页上抓取表格数据和图像?