view fca/writeFCA.py @ 0:62d2c72e4223

initial commit
author nothing@tehis.net
date Mon, 25 Feb 2013 14:40:54 +0000
parents
children
line wrap: on
line source
def writeCTX( path, matrix, cols, rows ):
    ctx = "B\n\n" + len(rows) + "\n" + len(cols) + "\n\n"

    for it in columns:
        ctx += it + "\n"

    for it in columns:
        ctx += it + "\n"

    ctx += "\n"

    for i in range(len(rows)):
        for j in range(len(columns)):
            if matrix[i][j] == 1:
                ctx += "X"
            else:
                html += "."
        html += "\n"

    if path != '':
        file = open(path, 'w')
        file.write(ctx)
        file.close()    

    return ctx