python : 随机数
2015-07-25 19:43
615 查看
示例:双色球 twocolorball.py
# -*- coding: cp936 -*- import random # 红球 red = [i for i in range(1,33+1)] # 一维数组 print '红球:',red kj = random.sample(red, 6) # 从list中随机获取6个元素 print '红球开奖:',kj # 蓝球 blue = random.randint(1,16+1) print '蓝球开奖:',blue
相关文章推荐
- python递归创建目录
- Python项目8:使用XML-RPC进行文件共享
- python下PCA算法与人脸识别
- Python项目7:自定义公告板
- python,list
- python 字符处理代码 1.0
- python-social-auth 管道机制
- python 简单日志文件
- python关于Mysql操作
- 《笨办法学python》-1
- python 字典操作
- python+Eclipse+pydev环境搭建
- Python特殊语法:filter、map、reduce、lambda
- Python内置的字符串处理函数
- openCV—Python(5)—— 图像几何变换
- Python 获得命令行参数的方法
- Python 3语法小记(九) 异常 Exception
- 使用python 处理发送POST请求
- 从python中copy与deepcopy的区别看python引用
- python实现类似switch功能