import random # 定义一个列表 items = ['apple', 'banana', 'cherry'] # 同时指定2个策略会报错 cum_weights = [2, 2, 2] weights = [1, 2, 3] item3 = random.choices(items, weights=weights, cum_weights=cum_weights, k=3) print(item3)