def export_to_txt(<EOL>table,<EOL>filename_or_fobj=None,<EOL>encoding=None,<EOL>frame_style="<STR_LIT>",<EOL>safe_none_frame=True,<EOL>*args,<EOL>**kwargs<EOL>):
<EOL>frame_style = _parse_frame_style(frame_style)<EOL>frame = FRAMES[frame_style.lower()]<EOL>serialized_table = serialize(table, *args, **kwargs)<EOL>field_names = next(serialized_table)<EOL>table_rows = list(serialized_table)<EOL>max_sizes = _max_column_sizes(field_names, table_rows)<EOL>dashes = [frame["<STR_LIT>"] * (max_sizes[field] + <NUM_LIT:2>) for field in field_names]<EOL>if frame_style != "<STR_LIT:None>" or not safe_none_frame:<EOL><INDENT>header = [field.center(max_sizes[field]) for field in field_names]<EOL><DEDENT>else:<EOL><INDENT>header = [<EOL>field.replace("<STR_LIT:U+0020>", "<STR_LIT:_>").ljust(max_sizes[field]) for field in field_names<EOL>]<EOL><DEDENT>header = "<STR_LIT>".format(<EOL>frame["<STR_LIT>"], "<STR_LIT>".format(frame["<STR_LIT>"]).join(header)<EOL>)<EOL>top_split_line = (<EOL>frame["<STR_LIT>"]<EOL>+ frame["<STR_LIT>"].join(dashes)<EOL>+ frame["<STR_LIT>"]<EOL>)<EOL>body_split_line = (<EOL>frame["<STR_LIT>"]<EOL>+ frame["<STR_LIT>"].join(dashes)<EOL>+ frame["<STR_LIT>"]<EOL>)<EOL>botton_split_line = (<EOL>frame["<STR_LIT>"]<EOL>+ frame["<STR_LIT>"].join(dashes)<EOL>+ frame["<STR_LIT>"]<EOL>)<EOL>result = []<EOL>if frame_style != "<STR_LIT:None>":<EOL><INDENT>result += [top_split_line]<EOL><DEDENT>result += [header, body_split_line]<EOL>for row in table_rows:<EOL><INDENT>values = [<EOL>value.rjust(max_sizes[field_name])<EOL>for field_name, value in zip(field_names, row)<EOL>]<EOL>row_data = "<STR_LIT>".format(frame["<STR_LIT>"]).join(values)<EOL>result.append("<STR_LIT>".format(frame["<STR_LIT>"], row_data))<EOL><DEDENT>if frame_style != "<STR_LIT:None>":<EOL><INDENT>result.append(botton_split_line)<EOL><DEDENT>result.append("<STR_LIT>")<EOL>data = "<STR_LIT:\n>".join(result)<EOL>if encoding is not None:<EOL><INDENT>data = data.encode(encoding)<EOL><DEDENT>return export_data(filename_or_fobj, data, mode="<STR_LIT:wb>")<EOL>
Export a `rows.Table` to text.

    This function can return the result as a string or save into a file (via
    filename or file-like object).

    `encoding` could be `None` if no filename/file-like object is specified,
    then the return type will be `six.text_type`.
    `frame_style`: will select the frame style to be printed around data.
    Valid values are: ('None', 'ASCII', 'single', 'double') - ASCII is default.
    Warning: no checks are made to check the desired encoding allows the
    characters needed by single and double frame styles.

    `safe_none_frame`: bool, defaults to True. Affects only output with
    frame_style == "None":
    column titles are left-aligned and have
    whitespace replaced for "_".  This enables
    the output to be parseable. Otherwise, the generated table will look
    prettier but can not be imported back.