配方管理库
pyprika的Python项目详细描述
配方管理库和命令行工具。
主要功能:
- 用于编码配方的yaml文件格式。
- 为人类友好语法编写的解析器。
有关更完整的信息,请参见the documentation 讨论。
示例
>>> import pyprika >>> recipe = pyprika.load(open('example.yaml')) >>> recipe.name 'Salt Water' >>> recipe.ingredients [<Ingredient: (1 cup) water>, <Ingredient: (1 cup) salt>, <Ingredient: pepper>] >>> recipe.directions ['Put it in a pot.', 'Boil it up.', 'Glug glug glug.'] >>> more_recipe = 2 * recipe >>> more_recipe.ingredients [<Ingredient: (2 cup) water>, <Ingredient: (2 cup) salt>, <Ingredient: pepper>]