摘要: 一、安装xlrd模块 到python官网下载http://pypi.python.org/pypi/xlrd模块安装,前提是已经安装了python 环境。二、使用介绍 1、导入模块 import xlrd 2、打开Excel文件读取数据data = xlrd.open_workbook('excel... 阅读全文
posted @ 2013-11-09 21:42 jianhong 阅读(132) 评论(0) 推荐(0)
摘要: 一、安装xlrd模块 到python官网下载http://pypi.python.org/pypi/xlrd模块安装,前提是已经安装了python 环境。二、使用介绍 1、导入模块 import xlrd 2、打开Excel文件读取数据data = xlrd.open_workbook('excel... 阅读全文
posted @ 2013-11-09 21:42 jianhong 阅读(165) 评论(0) 推荐(0)
摘要: #encoding:utf8import threadingimport timedata = 0def func(sleeptime): global data print threading.currentThread().getName() time.sleep(sleept... 阅读全文
posted @ 2013-11-09 19:08 jianhong 阅读(12200) 评论(0) 推荐(0)
摘要: #encoding:utf8import threadingimport timedata = 0def func(sleeptime): global data print threading.currentThread().getName() time.sleep(sleept... 阅读全文
posted @ 2013-11-09 19:08 jianhong 阅读(346) 评论(0) 推荐(0)
摘要: 该功能通过调用mySQLdb python库中的 cursor.executemany()函数完成批量处理。今天用这个函数完成了批量插入例程:def test_insertDB(options): conn = database.Connection(host=options.mysql_ho... 阅读全文
posted @ 2013-11-09 19:07 jianhong 阅读(262) 评论(0) 推荐(0)
摘要: 该功能通过调用mySQLdb python库中的 cursor.executemany()函数完成批量处理。今天用这个函数完成了批量插入例程:def test_insertDB(options): conn = database.Connection(host=options.mysql_ho... 阅读全文
posted @ 2013-11-09 19:07 jianhong 阅读(6100) 评论(0) 推荐(0)
摘要: 1. 函数原型声明:s为字符串,rm为要删除的字符序列s.strip(rm) 删除s字符串中开头、结尾处,位于 rm删除序列的字符s.lstrip(rm) 删除s字符串中开头处,位于 rm删除序列的字符s.rstrip(rm) 删除s字符串中结尾处,位于 rm删除... 阅读全文
posted @ 2013-11-09 14:40 jianhong 阅读(146) 评论(0) 推荐(0)
摘要: 1. 函数原型声明:s为字符串,rm为要删除的字符序列s.strip(rm) 删除s字符串中开头、结尾处,位于 rm删除序列的字符s.lstrip(rm) 删除s字符串中开头处,位于 rm删除序列的字符s.rstrip(rm) 删除s字符串中结尾处,位于 rm删除... 阅读全文
posted @ 2013-11-09 14:40 jianhong 阅读(452) 评论(0) 推荐(0)
摘要: "UnicodeEncodeError:'latin-1' codec can't encode character ..." This is because MySQLdb normally tries to encode everything to latin-1. This can be fi... 阅读全文
posted @ 2013-11-09 14:39 jianhong 阅读(324) 评论(0) 推荐(0)
摘要: "UnicodeEncodeError:'latin-1' codec can't encode character ..." This is because MySQLdb normally tries to encode everything to latin-1. This can be fi... 阅读全文
posted @ 2013-11-09 14:39 jianhong 阅读(257) 评论(0) 推荐(0)
摘要: python中函数参数的传递是通过赋值来传递的。函数参数的使用又有俩个方面值得注意:1.函数参数是如何定义的 2.在调用函数的过程中参数是如何被解析先看第一个问题,在python中函数参数的定义主要有四种方式:1.F(arg1,arg2,...)这 是最常见的定义方式,一个函数可以定义任意个参数,每... 阅读全文
posted @ 2013-11-09 12:26 jianhong 阅读(1021) 评论(2) 推荐(1)
摘要: python中函数参数的传递是通过赋值来传递的。函数参数的使用又有俩个方面值得注意:1.函数参数是如何定义的 2.在调用函数的过程中参数是如何被解析先看第一个问题,在python中函数参数的定义主要有四种方式:1.F(arg1,arg2,...)这 是最常见的定义方式,一个函数可以定义任意个参数,每... 阅读全文
posted @ 2013-11-09 12:26 jianhong 阅读(218) 评论(0) 推荐(0)
摘要: 前段时间在论坛里面有人提问说,class foo():member1member2...self.member1foo.member2其中的两个成员member1, member2有什么区别。。。这才知道python中也有自己的全局静态变量。实例的属性是实例的,如上class中的member1,对它... 阅读全文
posted @ 2013-11-09 12:25 jianhong 阅读(585) 评论(0) 推荐(0)
摘要: 静态方法要在类中使用静态方法,需在类成员函数前面加上@staticmethod标记符,以表示下面的成员函数是静态函数。使用静态方法的好处是,不需要定义实例即可使用这个方法。另外,多个实例共享此静态方法。代码如下:class SimClass(): @staticmethod def ... 阅读全文
posted @ 2013-11-09 12:24 jianhong 阅读(416) 评论(0) 推荐(0)