python编程快速上手之第12章实践项目参考答案(12.13.4)
#! python3 # encoding: UTF-8 import openpyxl,os from openpyxl.utils import get_column_letter os.chdir('C:\\Users\\Administrator\\Python35-32') wb = openpyxl.load_workbook('TxttoExcel.xlsx') sheet = wb.get_active_sheet() for n in range(1,sheet.max_column): file = open(str(n)+'.txt','w', encoding='utf-8') print(len(sheet.rows)) for m in range(1,sheet.max_row): file.write(str(sheet.cell(row=m, column=n).value))
posted on 2017-05-16 01:14 flying-wyf 阅读(185) 评论(0) 编辑 收藏 举报