#写入import xlwtworkbook=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=Truestyle.font=ft#第一种stylestyle2=xlwt.easyxf(‘pattern:pattern solid,fore_colour red;font:bold on;‘)#第二种stylesheetn.write(4,4,"Get over",style)sheetn.write(4,5,u"测试时",style2)workbook.save("test2.xlsx")
时间: 2024-10-08 10:34:38