python3 读写Excel xls文件
- 2007版以前的Excel(xls结尾的),需要使用xlrd读,xlwt写
- 2007版以后的Excel(xlsx结尾的),需要使用openpyxl来读写。
pypi的地址:
- https://pypi.python.org/pypi/xlwt
- https://pypi.python.org/pypi/xlrd
- https://pypi.python.org/pypi/openpyxl
import xlwt
aoid_name_dict = {}
with open('aoid_name.txt', 'r', encoding='utf8')as f:
for line in f:
aoid, name = line.strip('\n').split('\t')
wb = xlwt.Workbook(encoding='utf8')
ws = wb.add_sheet('She