1 import xlrd 2 import MySQLdb 3 def inMySQL(file_name): 4 wb = xlrd.open_workbook(file_name) 5 sh = wb.sheet_by_index(0) 6 data = [sh.ro...
分类:
数据库 时间:
2014-10-18 11:07:50
阅读次数:
280
任何应用都离不开数据,所以在学习python的时候,当然也要学习一个如何用python操作数据库了。MySQLdb就是python对mysql数据库操作的模块。官方Introduction :MySQLdb is an thread-compatible interface to the popul...
分类:
数据库 时间:
2014-10-18 11:07:19
阅读次数:
274
1 import MySQLdb 2 import xlwt 3 def outMySQL(file_name): 4 wb = xlwt.Workbook() 5 sh = wb.add_sheet('sheet 1',cell_overwrite_ok=True) 6 7 ...
分类:
数据库 时间:
2014-10-18 11:03:56
阅读次数:
176
一、前提准备 1 安装pip: sudo apt-get install python-pip 2 安装python的xlrd模块: sudo pip install xlrd 3 安装python的pyExcelerator模块: sudo pip install pyExcelerator 二、目录结构 1 static目录 3 ...
分类:
其他好文 时间:
2014-10-17 15:48:04
阅读次数:
153
如果使用executemany对数据进行批量插入的话,要注意一下事项:conn = MySQLdb.connect(host = “localhost”, user = “root”, passwd = “password”, db = “myDB”, charset=’utf8′)cursor =...
分类:
数据库 时间:
2014-10-17 15:02:35
阅读次数:
236
用python向MySQL中插入中文数据出错,原代码片段:1 db = MySQLdb.connect("localhost","root","123","TESTDB")2 cursor = db.cursor()3 sql = '''INSERT INTO aaaa(bb,cc) values(...
分类:
数据库 时间:
2014-10-17 15:01:52
阅读次数:
213
ImportError: No module named MySQLdb 该错误是源于我们没有安装Python连接MySQL所需的MySQLdb库而引起。 MySQL是最流行的开源数据库之一,但在Python标准库中并没有集成MySQL接口程序,MySQLdb是一个第三方包,...
分类:
数据库 时间:
2014-10-17 12:16:51
阅读次数:
204
1.32位与64位要分清2.selenium2library 库的安装 有依赖库 selenium 与 decorator,最好使用pip来安装,因为pip 会自动安装依赖库。3.如果是公司内网使用代理上网,RF无法识别IE的配置需要使用proxy.pac脚本实现代理上网配置方法 IE》工具》Int...
分类:
其他好文 时间:
2014-10-16 12:29:42
阅读次数:
237
#!/usr/bin/envpython
#encoding:utf-8
importMySQLdb
tell_file=‘/home/test/liyiliang/study/tell.info‘
f=file(tell_file)
account_list=f.readlines()
f.close()
forninaccount_list:
h=n.strip().split()
name=h[0]
phone=h[1]
try:
conn=MySQLdb.connect(host=‘x.x.x.x‘,..
分类:
编程语言 时间:
2014-10-15 15:47:11
阅读次数:
204
1、Python安装之后会自动安装pip和easy_install、setuptools,但是用的时候报错:Unable to create process using '“”C:\Program Files (x86)\Python33\python.exe“” “C:\Program Files...
分类:
编程语言 时间:
2014-10-15 03:16:09
阅读次数:
237