book = xlwt.Workbook()
sheet = book.add_sheet("sheet1")
title = ["id","name","sex","city"]
students = [
[1,"a","男","北京"],
[2,"b,"男","北京"],
[3,"c","女","深圳"],
[4,"d","女","北京"],
]
students.insert(0,title)
for row,student in enumerate(students):
for col,value in enumerate(student):
sheet.write(row,col,value)
book.save("test.xls")