
excel
huaMinPython
这个作者很懒,什么都没留下…
展开
-
openpyxl如何设置excel单元格cell自动换行
import openpyxlwb=openpyxl.load_workbook('test.xlsx')sheet=wb.activefor r in sheet: for c in r: c.alignment=openpyxl.styles.Alignment(wrapText=True)wb.save('test.xlsx')关键词 alignment, wrapText=True原创 2021-09-11 15:56:28 · 7946 阅读 · 0 评论 -
13.14.4 文本文件到电子表格。python编程快速上手--让繁琐工作自动化 第2版。【美】阿尔·斯维加特 Al Sweigart 著 王海鹏 译 中国工信出版集团 人民邮电出版社
import openpyxlwb=openpyxl.Workbook()sheet=wb.activetxtName='my_life.txt'with open(txtName) as tObj: lines=tObj.readlines()for i in range(len(lines)): sheet.cell(column=1,row=i+1).value=lines[i]wb.save('my_life.xlsx')原创 2021-09-05 06:50:56 · 253 阅读 · 0 评论