1. 环境准备
我使用的是在Win10下,需要安装几个依赖包:
pip install xlrd
pip install pandas
pip install openpyxl
如果需要用到数据库读写模块,则需要安装Mysql-Python模块:
[Win32位下载](https://download.lfd.uci.edu/pythonlibs/t7epjj8p/MySQL_python-1.2.5-cp27-none-win32.whl "Win32位下载")
2.上代码
代码完成的主要功能是从数据库读取BUG列表数据,同时写入数据库
import pandas as pd
title = list()
resolveBy = list()
resolution = list()
openedDate = list()
assignedDate = list()
resolvedDate = list()
closeDate = list()
## 从数据库中读取数据分别对列表赋值
data = pd.read_excel('1.xlsx', sheet_name='Sheet1')
print '标题||解决人||处理结果||创建日期||分配日期||解决日期||关闭日期'
data['标题'] = title
data['解决人'] = resolveBy
data['处理结果'] = resolution
data['创建日期'] = openedDate
data['分配日期'] = assignedDate
data['解决日期'] = resolvedDate
data['关闭日期'] = closeDate
data.to_excel('1.xlsx', sheet_name='Sheet1', index=False, header=True)
- 微信扫码赞助
- 支付宝赞助