【发布时间】:2016-09-06 07:31:55
【问题描述】:
我是 Python 的初学者。我尝试使用这种方法:
random.choice(my_dict.keys())
但是有一个错误:
'dict_keys' object does not support indexing
我的字典很简单,喜欢
my_dict = {('cloudy', 1 ): 10, ('windy', 1): 20}
请问您是如何解决这个问题的?非常感谢!
【问题讨论】:
标签: python dictionary random