类字典验证数据结构的容器
tg-option-container的Python项目详细描述
类字典验证数据结构的容器
文档可在阅读文档时获得: http://tg-option-container.readthedocs.io
开始
安装TG选项容器:
pip install tg-option-container
然后在项目中使用它:
fromtg_option_containerimportOption,OptionContainerclassCharacter(OptionContainer):props=[Option.string('name',None),Option.string('gender',None,choices=('M','N')),]john=Character(name='John Smith',gender='M')# This will raise: tg_option_container.types.InvalidOption: Invalid choice x for option `gender`, choices are ('M', 'N').mary=Character(name='Mary Smith',gender='x')
开发
您可以通过在 项目。