主页
Python
Python Random choices() 方法
demo_ref_random_choices
运行 ❯
×
更改方向
保存代码
更改主题
import random mylist = ["apple", "banana", "cherry"] print(random.choices(mylist, weights = [10, 1, 1], k = 14))