pip install xlwt
import xlwt
# 新建表格
book = xlwt.Workbook(encoding='utf-8', style_compression=0)
sheet = book.add_sheet('mysheet', cell_overwrite_ok=True)
# 往第一行的1到10列写数据
for i in range(10):
# 数字四舍五入保留两位小数
sheet.write(0, i, round(1.7416,2))
# 保存表格
book.save('data.xls')
GOOD LUCK!