py001- random中sample()函数的用法
sample(list, k)返回一个长度为k列表,里面存放list所产生随机不重复k个元素函数用法实例import randomlist = [1, 2, 3]print(random.sample(list ,2))list = ["china","python","sky"]print(random.sample(list ,2))
原创
2018-12-16 12:47:03 ·
75098 阅读 ·
12 评论