algorithms/k-means/utilities.py
def write_data(data, filename):
    """
    Writes data in a csv file.

    :param data: a list of lists
    :param filename: the path of the file in which data is written.
    The file is created if necessary; if it exists, it is overwritten.
    """
    # If you're curious, look at python's module csv instead, which offers
    # more powerful means to write (and read!) csv files.
    f = open(filename, 'w')
    for item in data:
        f.write(','.join([repr(x) for x in item]))
        f.write('\n')
    f.close()

    Writes data in a csv file.

    :param data: a list of lists
    :param filename: the path of the file in which data is written.
    The file is created if necessary; if it exists, it is overwritten.
    
Writes data in a csv file.
Writes data in a csv file .
def write_data(data, filename):
    f = open(filename, 'w')
    for item in data:
        f.write(','.join([repr(x) for x in item]))
        f.write('\n')
    f.close()
def write_data ( data , filename ) : f = open ( filename , 'w' ) for item in data : f . write ( ',' . join ( [ repr ( x ) for x in item ] ) ) f . write ( '\n' ) f . close ( )
Writes data in a csv file.
Writes data in a csv file .
"""
    Writes data in a csv file.

    :param data: a list of lists
    :param filename: the path of the file in which data is written.
    The file is created if necessary; if it exists, it is overwritten.
    """ # If you're curious, look at python's module csv instead, which offers # more powerful means to write (and read!) csv files.
data
a list of lists
a list of lists
filename
the path of the file in which data is written.
The file is created if necessary; if it exists, it is overwritten.
the path of the file in which data is written . The file is created if necessary ; if it exists it is overwritten .