import openpyxl
import re
# 打开 Excel 文件
wb = openpyxl.load_workbook('wpspict.xlsx')
# 获取活动工作表
ws = wb[wb.sheetnames[0]]
pattern = re.compile(r'\d+')
for image in ws._images:
# 输出图片的位置信息
print(image.anchor._from)
print(pattern.findall(str(image.anchor._from)))#通过正则获取位置
xy=pattern.findall(str(image.anchor._from))
x=xy[0]
y=xy[2]
由于没找到更为简便的办法,所以用re正则来体现