怎么样用python做个程序!要从列表中抽取随机取
import random
lis = ['%03d'%x for x in range(1,501)]
res = random.sample(lis,50)
for i,item in enumerate(res):
....print("%d :%s"%(i+1,item))
把. 换成缩进
import random
lis = ['%03d'%x for x in range(1,501)]
res = random.sample(lis,50)
for i,item in enumerate(res):
....print("%d :%s"%(i+1,item))
把. 换成缩进
多重随机标签