>>> import random >>> random.randint(1,10) ## 随机抽取1-10的数字 1 >>> random.randint(1,10) 4 >>> random.randint(1,10) 9 >>> random.randint(1,100) 67 >>> random.randint(1,100) 42 >>> random.randint(1,100) 6 >>> a = ["aa","bb","cc","dd","ee","ff"] >>> random.choice(a) ## 随机抽奖 'bb' >>> random.choice(a) 'ee' >>> random.choice(a) 'cc' >>> random.choice(a) 'bb' >>> random.choice(a) 'bb' >>> random.choice(a) 'bb'