nothing@0: def writeCTX( path, matrix, cols, rows ): nothing@0: ctx = "B\n\n" + len(rows) + "\n" + len(cols) + "\n\n" nothing@0: nothing@0: for it in columns: nothing@0: ctx += it + "\n" nothing@0: nothing@0: for it in columns: nothing@0: ctx += it + "\n" nothing@0: nothing@0: ctx += "\n" nothing@0: nothing@0: for i in range(len(rows)): nothing@0: for j in range(len(columns)): nothing@0: if matrix[i][j] == 1: nothing@0: ctx += "X" nothing@0: else: nothing@0: html += "." nothing@0: html += "\n" nothing@0: nothing@0: if path != '': nothing@0: file = open(path, 'w') nothing@0: file.write(ctx) nothing@0: file.close() nothing@0: nothing@0: return ctx