#!/usr/bin/env python# coding:utf-8# 双色球机选脚本# Copyright(C) from random import sample, choiceN = 5red = range(1, 33) #红球blue = range(1, 16) #蓝球lots = []for x in range(N):lots.append(sorted(sample(red, 6)) + [choice(blue)])for n, l in enumerate(lots):i = 1print "%c:" % chr(65+n),for x in l:if i == 7:print "-%02d" % x,else:print "%02d" % x,i += 1print
输出样例:
A: 06 14 15 18 20 27 -02
B: 06 09 18 19 21 32 -07
C: 06 10 18 20 24 31 -12
D: 01 12 15 20 23 25 -10
E: 02 03 07 08 11 29 -03
下次就用自己的脚本来选号了,哈哈...偶的500万