DefaultSplitter

class astropy.io.ascii.DefaultSplitter[source] [edit on github]

Bases: astropy.io.ascii.BaseSplitter

Default class to split strings into columns using python csv. The class attributes are taken from the csv Dialect class.

Typical usage:

# lines = ..
splitter = ascii.DefaultSplitter()
for col_vals in splitter(lines):
    for col_val in col_vals:
         ...

Attributes Summary

csv_writer
csv_writer_out
delimiter
doublequote
escapechar
quotechar
quoting
skipinitialspace

Methods Summary

__call__(lines) Return an iterator over the table lines, where each iterator output is a list of the split line values.
join(vals)
process_line(line) Remove whitespace at the beginning or end of line.

Attributes Documentation

csv_writer = None
csv_writer_out = <_io.StringIO object>
delimiter = ' '
doublequote = True
escapechar = None
quotechar = '"'
quoting = 0
skipinitialspace = True

Methods Documentation

__call__(lines)[source] [edit on github]

Return an iterator over the table lines, where each iterator output is a list of the split line values.

Parameters:

lines : list

List of table lines

Returns:

lines : iterator

join(vals)[source] [edit on github]
process_line(line)[source] [edit on github]

Remove whitespace at the beginning or end of line. This is especially useful for whitespace-delimited files to prevent spurious columns at the beginning or end. If splitting on whitespace then replace unquoted tabs with space first