Python操作Excel之xlwt

#写入
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中多线程及socket的用法


下一篇:Resumable.js – 基于 HTML5 File API 的文件上传