Python 导入json2xml库时出现无效语法错误
我正在尝试导入以下库:Python 导入json2xml库时出现无效语法错误,python,Python,我正在尝试导入以下库: import json2xml from json2xml.utils import readfromstring 但是,当我执行第二行时,会出现以下错误: Traceback (most recent call last): File "C:\Users\denis\Desktop\Pazaruvaj Upload\Pazaruvaj_Part1_Test.py", line 12, in <module> from jso
import json2xml
from json2xml.utils import readfromstring
但是,当我执行第二行时,会出现以下错误:
Traceback (most recent call last):
File "C:\Users\denis\Desktop\Pazaruvaj Upload\Pazaruvaj_Part1_Test.py", line 12, in <module>
from json2xml.utils import readfromurl, readfromstring, readfromjson
File "C:\Python27\lib\site-packages\json2xml\utils.py", line 19
def readfromjson(filename: str) -> dict:
^
SyntaxError: invalid syntax
回溯(最近一次呼叫最后一次):
文件“C:\Users\denis\Desktop\Pazaruvaj Upload\Pazaruvaj_Part1_Test.py”,第12行,在
从json2xml.utils导入readfromurl、readfromstring、readfromjson
文件“C:\Python27\lib\site packages\json2xml\utils.py”,第19行
def readfromjson(文件名:str)->dict:
^
SyntaxError:无效语法
无法在网上找到有关此问题的任何信息
注意:我没有从json2xml导入json2xml编写,因为它给出了相同的错误根据,json2xml与Python2不兼容
Python2已弃用,请更新为Python3。那么这个图书馆应该可以用了。谢谢!我没想到要检查一下。