Python Excel及setuptool安装
1. 安装openpyxl模块
pip install openpyxl
2. 代码
# coding=utf-8 from openpyxl import load_workbook workbook = load_workbook('设备编号.xlsx') table = workbook.get_sheet_by_name('Sheet1') # 取值 value = table.cell(row=1, column=1).value # 填写单元格 table['B1'] = '数据' # 保存 workbook.save('XX.xlsx')
获取最大行列值
print(table.max_row)
print(table.max_column)
参考:
https://www.cnblogs.com/sun-haiyu/p/7096423.html
xlrd及xlwt
https://www.cnblogs.com/MrLJC/p/3715783.html
安装setuptools:
1. 可以先打开setuptools的python官网看看setuptools软件包如何安装:
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py > python ez_setup.py --use
2. 也可以下载setuptools软件包后安装:
①下载setuptools包:
②解压setuptools包:
tar zxvf setuptools-2.0.tar.gz
③切换到当前文件夹:
cd setuptools-2.0
④ 编译setuptools:
python setup.py build
⑤开始执行setuptools安装
python setup.py install