1 import random 2 3 x = int(input(‘请输入题库:‘)) 4 y = int(input(‘请输入次数:‘)) 5 sep = list(range(1,x+1)) 6 a = random.sample(sep,y) 7 a.sort() 8 print(a)
python去不重复的随机数
原文:http://www.cnblogs.com/pythonbin/p/7637704.html