Python writes the special xlsx type of the table

Don't talk nonsense, just go ahead!
In order to satisfy the problem of netizens, I wrote an impromptu
need to install the library

import xlwt
import os

Code directly

#!/usr/bin/python
# -*- coding:utf8 -*-

import xlwt
import os
workbook=xlwt.Workbook(encoding='utf-8')
booksheet=workbook.add_sheet('Sheet 1', cell_overwrite_ok=True)
DATA=(('id号','姓名','年龄','性别','成绩'),
   ('1001','A','11','男','12'),
   ('1002','B','12','女','22'),
   ('1003','C','13','女','32'),
   ('1004','D','14','男','52'),
   )
for i,row in enumerate(DATA):
  for j,col in enumerate(row):
    booksheet.write(i,j,col)
workbook.save('soubei1123.xlsx')
print(os.getcwd())

The getchwd() function returns the current working directory.

As shown
![Insert picture description here](https://img-blog.csdnimg.cn/2020091409481799.png#pic_center

Guess you like

Origin blog.csdn.net/weixin_37254196/article/details/108573083