(txt)
return data
r"""Parse a tab-separated table into list of dicts.

    Expect first row to be column names.

    Very primitive.

    Example:
    >>> parse_tabbed_table('col1\tcol2\nval1\tval2\n')
    [{'col2': 'val2', 'col1': 'val1'}]
r"""Parse a tab-separated table into list of dicts.
r Parse a tab - separated table into list of dicts .
def parse_tabbed_table(txt):
    r"""Parse a tab-separated table into list of dicts.

    Expect first row to be column names.

    Very primitive.

    Example:
    >>> parse_tabbed_table('col1\tcol2\nval1\tval2\n')
    [{'col2': 'val2', 'col1': 'val1'}]
    """

    txt = txt.replace("\r\n", "\n")
    fields = None
    data = []
    for ln in txt.split("\n"):
        if not ln:
            continue
        if not fields:
            fields = ln.split("\t")
            continue
        cols = ln.split("\t")
        if len(cols) != len(fields):
            continue
        row = dict(zip(fields, cols))
        data.append(row)
    return data
def parse_tabbed_table ( txt ) : txt = txt . replace ( "\r\n" , "\n" ) fields = None data = [ ] for ln in txt . split ( "\n" ) : if not ln : continue if not fields : fields = ln . split ( "\t" ) continue cols = ln . split ( "\t" ) if len ( cols ) != len ( fields ) : continue row = dict ( zip ( fields , cols ) ) data . append ( row ) return data