随机获取列表中几个值

import random

list=(1,2,3,4,5)

m=random.sample(list,3)

#随机从list中取3个值

猜你喜欢

转载自blog.csdn.net/zfs1570/article/details/92059913
今日推荐