生成给定类型的随机字典的简单python包。
random-dict的Python项目详细描述
生成给定类型的随机字典的简单python包。
如何安装此软件包?
像往常一样,只需使用pip:
pip install random_dict
用法示例
随机字符串dict
此函数将生成一个字典,其中最大值为max_depth和max_height类型为string。
fromrandom_dictimportrandom_string_dictfromrandomimportrandintrandom_string_dict(randint(1,10),randint(1,10))
随机布尔dict
此函数将生成一个字典,其中最大值为max_depth和max_height类型为bool。
fromrandom_dictimportrandom_bool_dictfromrandomimportrandintrandom_bool_dict(randint(1,10),randint(1,10))
随机浮点指令
此函数将生成一个字典,其中最大值为max_depth和max_height类型float。
fromrandom_dictimportrandom_float_dictfromrandomimportrandintrandom_float_dict(randint(1,10),randint(1,10))
随机指令
此函数将生成一个字典,其中最大值为max_depth和max_height类型int。
fromrandom_dictimportrandom_int_dictfromrandomimportrandintrandom_int_dict(randint(1,10),randint(1,10))
随机指令
此函数将生成一个字典,其中最多给定混合类型的max_depth和max_height。
fromrandom_dictimportrandom_dictfromrandomimportrandintrandom_dict(randint(1,10),randint(1,10))
一些生成的示例可以在examples文件夹中找到。