2013-07-22 28 views

回答

1
>>> res = { 
...  "type": "array", 
...  "items": { 
...   "type": "string" 
...  } 
... } 
>>> 
>>> one = ["one", "two"] 
>>> 
>>> 
>>> validictory.validate(one, res) 
>>> # No error 

「validictory是一個通用Python數據驗證程序,允許驗證任意Python數據結構。」 (看到這個 - >Validictory docs

+1

謝謝Alberto!很有幫助。將研究這個簡單的驗證器。 – goldisfine

+0

在這裏你有一個非常漂亮的教程http://www.alexconrad.org/2011/10/json-validation.html –

+0

從jsonschema到目前爲止使用'驗證'https://pypi.python.org/pypi/ jsonschema – goldisfine

相關問題