import xlwt

def writeExcelFile(filename,content):
workbook = xlwt.Workbook(encoding='utf-8')
booksheet = workbook.add_sheet('信息表',cell_overwrite_ok=True)
  #循环存入
for i in range(0, len(content)):
for j in range(0, len(content)):
booksheet.write(j, i, content[i][j])

workbook.save(filename) #保存

if __name__ == '__main__':
content = [["name", "jim", "hmm", "lilei"], ["sex", "man", "woman", "man"], ["age", 19, 24, 24], ["country", "USA", "CHN", "CHN"]]
writeExcelFile('员工信息表.xls',content)

#效果图

python写入内容到Excel文件中

 

相关文章:

  • 2021-12-09
  • 2021-09-22
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-22
  • 2021-09-13
  • 2021-10-03
  • 2021-09-18
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案