xlwt写入excel时出错解决方法

#读取excel文件内容
import xlrd
import xlwt
workbook=xlrd.open_workbook("text1.xlsx")
sheet_name=workbook.sheet_names()
print(sheet_name)
sheet=workbook.sheet_by_index(0)
print(sheet.cell_value(1,3))
rows=sheet.row_values(5)  #fiveth row  output
cols=sheet.col_values(3)  #therd col  output
print(rows)
print(cols)
#print(sheet.name,sheet.nrows,sheet.ncols)
#写入数据到excel文件,调试环境 debian10,python3.7,pycharm 2020.1
#from xlwt import Worksheet
workbook = xlwt.Workbook(encoding='ascii', style_compression=0) #这句可以正确执行!
#workbook = xlwt.Workbook 如果程序这样写,运行时总是出错!参见xlwt包文件,网址https://xlwt.readthedocs.io/en/latest/api.html
worksheet = workbook.add_sheet("test1",cell_overwrite_ok=True)
worksheet.write(0,0,1357)
worksheet.write(0,1,358)
workbook.save("texcel.xls")