import xlwtworkbook = xlwt.Workbook(encoding = 'ascii') #创建workbook 括号内容视情况而定sheetname = 'Sheet'booksheet =workbook.add_sheet(sheetname) #创建表booksheet.write(i,j,'x') #i表示第几行,j表示第几列,x表示写的内容xlsname='qqqq.xls' #表格的名字workbook.save(xlsname) #保存文件