#写入
import xlwt
workbook=xlwt.Workbook()
sheetn=workbook.add_sheet(u"测试数据",cell_overwrite_ok=True)
sheetn.write(0,0,u"中国") sheetn.write(1,0,u"美国") sheetn.write(2,0,u"德国") style=xlwt.XFStyle() ft=xlwt.Font() ft.name="Times New Roman" ft.bold=True style.font=ft#第一种style style2=xlwt.easyxf('pattern:pattern solid,fore_colour red;font:bold on;')#第二种style sheetn.write(4,4,"Get over",style) sheetn.write(4,5,u"测试时",style2) workbook.save("test2.xlsx")
Python操作Excel之xlwt
最新推荐文章于 2024-09-04 14:45:17 发布