使用python 3.5执行脚本错误,但在3.8下工作正常



我正在Python 3.5中运行以下脚本:)

def series_to_fac_details_xml(s):
return fac_details_xml_template.format(**s)
for index, row in df3.iterrows():
details = series_to_fac_details_xml(row)
with open(fr"C:UsersMax12DesktopxmlpdfminerUiPathattachments75090058StatusAfgeleverd{row['Output']}.xml", "w") as f:
f.write(fac_doc_template.format(fac_details=details))

它给你的错误是"无效语法"。然而,在python 3.8中,它工作得很好。

我必须运行Python 3.5,因为UiPath只支持Python版本>3.6

你能帮帮忙吗?

问题在这一行:

with open(fr"C:UsersMax12DesktopxmlpdfminerUiPathattachments75090058StatusAfgeleverd{row['Output']}.xml", "w") as f:

在python 3.5中不能使用f-string,因为它们是在python 3.6中添加的。使用其他字符串格式化方法,如format()

相关内容

最新更新