writing a QTableWidget to a .csv or .xls
问题 Is it possible to write the contents of a QTableWidget to a csv? I found a question about writing to an .xls using xlwt, but can't seem to get it to work using my code. def saveFile(self): filename = unicode(QtGui.QFileDialog.getSaveFileName(self, 'Save File', '', ".xls(*.xls)")) wbk = xlwt.Workbook() self.sheet = wbk.add_sheet("sheet") self.write() wbk.save(filename) def write(self): for col in range (self.coordinates.columnCount()): for row in range(self.coordinates.rowCount()): text=str