Suds reply python语法错误:无效语法
我有一个简短的答复。我使用result=Client.dict(results)将其格式化为dict对象。当我尝试访问部分结果(parts=result['Product']['ProductPartArray']['ProductPart'])时,它会在内部控制台上不断给我一个语法错误。我不知道为什么会发生这种情况,也不知道如何应对。代码运行良好,并提供了所需的结果,但它将我带到带有语法错误的内部控制台。有什么帮助吗Suds reply python语法错误:无效语法,python,api,suds,Python,Api,Suds,我有一个简短的答复。我使用result=Client.dict(results)将其格式化为dict对象。当我尝试访问部分结果(parts=result['Product']['ProductPartArray']['ProductPart'])时,它会在内部控制台上不断给我一个语法错误。我不知道为什么会发生这种情况,也不知道如何应对。代码运行良好,并提供了所需的结果,但它将我带到带有语法错误的内部控制台。有什么帮助吗 Thanks (reply){ Product = (P
Thanks
(reply){
Product =
(Product){
productId = "12"
productName = "Pull-A-Part Key Tag"
description[] =
"<ul><li>Printed Paper Inserts Are A Great Way To Customize At A Low Cost</li><li>Includes One Color Imprint On White Paper Background</li></ul>",
ProductMarketingPointArray =
(ProductMarketingPointArray){
ProductMarketingPoint[] =
(ProductMarketingPoint){
pointType = "Highlight"
pointCopy = "Printed Paper Inserts Are A Great Way To Customize At A Low Cost"
},
(ProductMarketingPoint){
pointType = "Highlight"
pointCopy = "Includes One Color Imprint On White Paper Background"
},
}
export = True
ProductCategoryArray =
(ProductCategoryArray){
ProductCategory[] =
(ProductCategory){
category = "Tools, Lights & Key Tags"
subCategory = "Metal - Bottle Opener / Key Tags"
},
}
ProductPartArray =
(ProductPartArray){
ProductPart[] =
(ProductPart){
partId = "0012SIL"
ColorArray =
(ColorArray){
Color[] =
(Color){
colorName = "SILVER"
},
}
Dimension =
(Dimension){
dimensionUom = "MM"
depth = 0.0
height = 3.5
width = 0.5
weightUom = "LB"
weight = 0.036
}
isRushService = True
ShippingPackageArray =
(ShippingPackageArray){
ShippingPackage[] =
(ShippingPackage){
packageType = "Box"
description = "EE"
quantity = 500.0
dimensionUom = "IN"
depth = 13.0
height = 11.0
width = 13.0
weightUom = "LB"
weight = 24.0
},
(ShippingPackage){
packageType = "Box"
description = "E0"
quantity = 1000.0
dimensionUom = "IN"
depth = 16.0
height = 12.0
width = 15.0
weightUom = "LB"
weight = 47.0
},
(ShippingPackage){
packageType = "Box"
description = "FA"
quantity = 250.0
dimensionUom = "IN"
depth = 10.0
height = 6.0
width = 7.0
weightUom = "LB"
weight = 9.0
},
}
endDate = 2016-01-31 00:00:00
effectiveDate = 2016-01-01 00:00:00
isCloseout = False
isCaution = False
isOnDemand = False
isHazmat = False
},
}
lastChangeDate = 2016-01-01 00:00:00
creationDate = 2016-01-01 00:00:00
endDate = 2016-01-31 00:00:00
effectiveDate = 2016-01-01 00:00:00
isCaution = False
isCloseout = False
lineName = "HIT"
}
}
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "C:\Users\Justin Sumey\Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
handler(msg)
File "C:\Users\Justin Sumey\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 189, in _handle_execute_reply
self.handle_exec_method(msg)
File "C:\Users\Justin Sumey\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 244, in handle_exec_method
view = ast.literal_eval(data['text/plain'])
File "C:\Users\Justin Sumey\Anaconda2\lib\ast.py", line 49, in literal_eval
node_or_string = parse(node_or_string, mode='eval')
File "C:\Users\Justin Sumey\Anaconda2\lib\ast.py", line 37, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 25
'view': Pull-A-Part Key Tag},
^
SyntaxError:
invalid syntax
谢谢
(答复){
产品=
(产品){
productId=“12”
productName=“拉一部分钥匙标签”
说明[]=
“- 打印纸插页是一种以低成本定制的好方法
- 在白纸背景上有一个彩色印记
”,
ProductMarketingPointArray=
(ProductMarketingPointArray){
ProductMarketingPoint[]=
(产品营销点){
pointType=“突出显示”
pointCopy=“打印纸插页是以低成本定制的好方法”
},
(产品营销点){
pointType=“突出显示”
pointCopy=“在白纸背景上包括一个彩色印记”
},
}
导出=真
ProductCategoryArray=
(ProductCategoryArray){
ProductCategory[]=
(产品类别){
category=“工具、灯光和钥匙标签”
子类别=“金属-开瓶器/钥匙标签”
},
}
ProductPartArray=
(ProductPartArray){
ProductPart[]=
(产品部分){
partId=“0012SIL”
ColorArray=
(彩色阵列){
颜色[]=
(颜色){
colorName=“银色”
},
}
维度=
(尺寸){
尺寸UOM=“MM”
深度=0.0
高度=3.5
宽度=0.5
weightUom=“LB”
重量=0.036
}
isRushService=True
ShippingPackageArray=
(ShippingPackageAry){
ShippingPackage[]=
(装运包){
packageType=“Box”
description=“EE”
数量=500.0
dimensionUom=“IN”
深度=13.0
高度=11.0
宽度=13.0
weightUom=“LB”
重量=24.0
},
(装运包){
packageType=“Box”
description=“E0”
数量=1000.0
dimensionUom=“IN”
深度=16.0
高度=12.0
宽度=15.0
weightUom=“LB”
重量=47.0
},
(装运包){
packageType=“Box”
description=“FA”
数量=250.0
dimensionUom=“IN”
深度=10.0
高度=6.0
宽度=7.0
weightUom=“LB”
重量=9.0
},
}
结束日期=2016-01-31 00:00:00
生效日期=2016-01-01 00:00:00
isCloseout=False
错误
isOnDemand=错误
isHazmat=False
},
}
lastChangeDate=2016-01-01 00:00:00
creationDate=2016-01-01 00:00:00
结束日期=2016-01-31 00:00:00
生效日期=2016-01-01 00:00:00
错误
isCloseout=False
lineName=“命中”
}
}
^
SyntaxError:无效语法
回溯(最近一次呼叫最后一次):
文件“C:\Users\Justin Sumey\Anaconda2\lib\site packages\qtconsole\base\u frontend\u mixin.py”,第163行,在调度中
处理程序(msg)
文件“C:\Users\Justin Sumey\Anaconda2\lib\site packages\spyder\widgets\ipythonsole\namespacebrowser.py”,第189行,在句柄执行回复中
self.handle\u exec\u方法(msg)
handle\u exec\u方法中的文件“C:\Users\Justin Sumey\Anaconda2\lib\site packages\spyder\widgets\ipythonsole\shell.py”,第244行
view=ast.literal\u eval(数据['text/plain'])
文件“C:\Users\Justin Sumey\Anaconda2\lib\ast.py”,第49行,文本值
node_或_string=parse(node_或_string,mode='eval')
文件“C:\Users\Justin Sumey\Anaconda2\lib\ast.py”,第37行,在parse中
返回编译(源、文件名、模式、仅PyCF\u AST)
文件“”,第25行
“视图”:拉动部件键标记},
^
合成错误:
无效语法
product\u name=str(结果['product']['productName'])我必须将str函数添加到name属性中