
python
唧唧复唧唧_
一只自由的唧唧...
展开
-
Python中__init__方法介绍
转载自http://www.2cto.com/kf/201009/74919.html转载 2014-10-10 13:46:50 · 1312 阅读 · 0 评论 -
python中bool值
1.在数值上下文环境中,True被当作1,False被当作0,例如 True+3=>4 2.其他类型值转换bool值时除了''、""、''''''、""""""、0、()、[]、{}、None、0.0、0L、0.0+0.0j、False为False,其他都为True 例如 bool(-2)=>True转载 2015-03-05 11:33:47 · 1125 阅读 · 0 评论 -
python random模块整理
--------------------------------- import random Python中的random模块用于生成随机数。下面介绍一下random模块中最常用的几个函数。 random.random random.random()用于生成一个0到1的随机符点数: 0 random.uniform转载 2015-05-11 09:46:46 · 338 阅读 · 0 评论 -
python字符串/元组/列表/字典互转
#-*-coding:utf-8-*- #1、字典 dict = {'name': 'Zara', 'age': 7, 'class': 'First'} #字典转为字符串,返回: {'age': 7, 'name': 'Zara', 'class': 'First'} print type(str(dict)), str(dict) #字典可以转为元组,返回:('age', 'name'转载 2015-05-07 14:51:29 · 292 阅读 · 0 评论