我一直在尝试在PowerPoint演示文稿的每张幻灯片上输入一系列图片。我输入图像路径和相关尺寸,但出现我不理解的错误。
for k in xrange(0, len(prs.slides)):
img_path = os_path + str(k+1) + '.png'
left = Cm(1.21)
top = Cm(4.72)
width = Cm(5)
height = Cm(5)
pic = prs.slides[k].shapes.add_picture(img_path, left, top, width, height)
然后出现此错误:
File "src/lxml/parser.pxi", line 1819, in lxml.etree._parseMemoryDocument (src\lxml\lxml.etree.c:116494)
File "src/lxml/parser.pxi", line 1700, in lxml.etree._parseDoc (src\lxml\lxml.etree.c:115040)
File "src/lxml/parser.pxi", line 1040, in lxml.etree._BaseParser._parseUnicodeDoc (src\lxml\lxml.etree.c:109165)
File "src/lxml/parser.pxi", line 573, in lxml.etree._ParserContext._handleParseResultDoc (src\lxml\lxml.etree.c:103404)
File "src/lxml/parser.pxi", line 683, in lxml.etree._handleParseResult (src\lxml\lxml.etree.c:105058)
File "src/lxml/parser.pxi", line 613, in lxml.etree._raiseParseError (src\lxml\lxml.etree.c:103967)
lxml.etree.XMLSyntaxError: EntityRef: expecting ';', line 3, column 31
肯定有对应img_path的文件,所以不知道还有什么问题