摘要: 1,下载mysql-connector-python-2.0.4 pythoin访问mysql需要有客户端,这个就是连接mysql的库 解压后如下图: 双击lib 以windows为例 把mysql复制到Lib\site-packages linux下可以找到site-packages 完成上面2步 阅读全文
posted @ 2016-01-27 20:48 面向-阳光 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 1.list.append 2.list.clear 3.list.copy 4.list.count 5.list.extend 6.list.index 7.list.insert 9.list.remove 10.list.reverse 11.list.sort tuple()元组 1.tu 阅读全文
posted @ 2016-01-27 20:34 面向-阳光 阅读(223) 评论(0) 推荐(0) 编辑
摘要: dict() 方法 1.dict.clear 清除字典元素 2.dict.copy #浅拷贝dictionary 3.dict.fromkeys #返回一个新的dictionary,key由iterable的元素组成,value等于value 4.dict.get#返回dictionary中key为 阅读全文
posted @ 2016-01-27 20:29 面向-阳光 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 字符串有2种表示方式:单引号和双引号!他们没有任何区别!比如: 但是我觉得组合起来用: 转义:"i love \"python\"" 拼接: 最好不要用"+",连接,因为这样连接,每+一次就会在内存在创建一连续的空间,推荐使用格式化字符串,我常用的是: str和repr: str 会把值转成合理的字 阅读全文
posted @ 2016-01-27 19:43 面向-阳光 阅读(181) 评论(0) 推荐(0) 编辑
摘要: 都说字典是无序,我却发现,我们把数字当成键的时候,10000条也是有序,为什么呢,看了内置方法,我发现: 字典的键,是hash()之后找到内存地址,存入字典的而hash(1)的值是不会的,hash(“1”)就不一样了! 官方文档: A mapping object maps hashable val 阅读全文
posted @ 2016-01-27 17:26 面向-阳光 阅读(1484) 评论(0) 推荐(0) 编辑
摘要: str()的方法 字符串练习 1.str.capitalize str.capitalize #返回首字母大写,其他字母小写的字符串 >>> a = 'gwdsr' >>> a.capitalize() 'gwdsr' >>> 2.str.casefold str.casefold #字符串转换成小 阅读全文
posted @ 2016-01-27 17:16 面向-阳光 阅读(219) 评论(0) 推荐(0) 编辑