我是JSON的初学者,现在我将使用Python。 最近我做了这样的代码:
import json
def product():
itemId = 84576454
itemName = 'FGX Flannel Shirt'
price = 195000
availableColorAndSize = {
'color': {'blue-black': ['M', 'L', 'XL'],
'black-white': ['L']}
}
freeShiping = False
输出文件应该如下所示:
^{pr2}$在我完成这个之前:Store Python function in JSON 但我仍然很困惑,不知道如何返回该函数来生成JSON。在
Python的内置JSON库可以为您做到这一点。四个主要功能如下:
所以你可以使用:
相关问题 更多 >
编程相关推荐