python 写入excel

1、python写入excel

需要import xlwt

excel = xlwt.Workbook()  # 创建一个Excel
sheet = excel.add_sheet('Sheet1')  # 在其中创建一个名为hellosheet
sheet.write(0, 0, u'企业名称')  # sheet里第一行第一列写一个数据
sheet.write(0, 1, u'企业注册号')  # sheet里第二行第一列写一个数据
excel.save(save_dir)

2、如果需要往excel写入中文

excel = xlwt.Workbook(encoding = 'utf-8')  # 创建一个Excel







猜你喜欢

转载自blog.csdn.net/q_t_pang/article/details/80739657