def write(filename, comments, rec, overwrite=False):
    # open the file for writing
    f = fileiobase.open_towrite(filename, overwrite)

    # write out the comment lines at the top of the file
    for c in comments:
        f.write(c)

    # Determind the list of column names
    names = rec.dtype.names

    # Determind the list of column formats
    sizes = [rec.dtype[n].itemsize for n in names]
    kinds = [rec.dtype[n].kind for n in names]
    formats = [k + str(s) for s, k in zip(sizes, kinds)]

    # write out the NAMES and FORMATS lines
    f.write("# NAMES " + " ".join(names) + "\n")
    f.write("# FORMATS " + " ".join(formats) + "\n")

    # maximum string length for each column
    col_len = [max([len(str(i)) for i in rec[n]]) for n in names]

    # write out each line of the table
    for row in rec:
        s = " ".join([str(v).ljust(l) for v, l in zip(row, col_len)])
        f.write(s + "\n")
    f.close()


# Row functions
Write a nmrglue table to file.
dataset/ETHPy150Open jjhelmus/nmrglue/nmrglue/fileio/table.py/write