#-*-coding=gbk-*- import sys import random a=[] try: for x in range(1,20+1,1): #打印20人数编号 a.append(x) i=0 key=raw_input("请输入a,开始抽奖号码:") while (key=="a"): b=random.choice (a) #b=str(b) i+=1 print " 第%d个中奖号: %s"% (int(i),b) a.remove(b) key2=raw_input("请输入a,开始抽奖号码:") else: print ('ERROR!!') except IndexError as e: print "已经抽完!"