./获取XML.py:第3行:意外标记“(”附近出现语法错误

2024-09-27 09:30:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我得到一个错误:

./getXml.py: line 3: syntax error near unexpected token (' ./getXml.py: line 3:tree=ET.parse("/home/svc_quickbuild/Documents/test/CI-TT-PSA.P4CNS.U-MAP.AFRICA.NDS-8.0.0.meta.xml")'

当我尝试执行时:

import xml.etree.ElementTree as ET

tree=ET.parse("/home/svc_quickbuild/Documents/test/CI-TT-PSA.P4CNS.U-MAP.AFRICA.NDS-8.0.0.meta.xml")

root= tree.getroot();

first_tag=root.find('tns:navigationSoftwareCompatibilityList').text

print(first_tag)

Tags: pytestcitreehomeparselinexml

热门问题