我试图在代码中查找错误,但我无法,此外,我尝试使用以下命令:“ sed -i's / \ x0 // g'filename”,但未进行任何更改。也许有人可以帮助我。预先谢谢您!
from pptx import Presentation
from pptx.dml.color import RGBColor
prs = Presentation()
title_slide_layout = prs.slide_layouts[0]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title # title = prs.slides.add_slide(title_slide_layout).shapes.title
subtitle = slide.placeholders[1] # subtitle = prs.slides.add_slide(title_slide_layout).placeholders[1]
title.text = "Hello, World!" # prs.slides.add_slide(title_slide_layout).shapes.title.text = "Hello World!"
subtitle.text = "python-pptx was here!"
title.text_frame.paragraphs[0].font.color.rgb = RGBColor(59,89, 152)
prs.slides.add_slide(title_slide_layout).placeholders[1].text = "python-pptx was here!"
prs.save('test.pptx')´´´
答案 0 :(得分:0)
您可以通过将文件声明为utf-8来解决问题。您所要做的就是将以下行放在文件开头:
# -*- coding: utf-8 -*-