随机取 list 中的元素

import random
a = [1,2,3,4,5,6,7]
b = random.sample(a, 5)
print b
原文地址:https://www.cnblogs.com/AngueTone/p/7340493.html