import random random.sample()生成不相同的随机数 list = random.sample(range(1,100),10) print(list) 这三行程序功能:在1-100之间产生不相同的10个随机数。