astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v5.2.1 »
- ASCII Tables (`astropy.io.ascii`) »
- DefaultSplitter

# DefaultSplitter

class astropy.io.ascii.DefaultSplitter

  Bases: `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` | one-character string used to separate fields.
  `doublequote` | character to remove special meaning from following character
  `escapechar` | one-character stringto quote fields containing special characters
  `quotechar` | control how instances of quotechar in a field are quoted
  `quoting` | control when quotes are recognized by the reader
  `skipinitialspace` | ignore whitespace immediately following the delimiter

  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.
  `process_val`(val) | Remove whitespace at the beginning or end of value.

  Attributes Documentation

  csv_writer = None
  csv_writer_out = <_io.StringIO object>
  delimiter = ' '

    one-character string used to separate fields.

  doublequote = True

    character to remove special meaning from following character

  escapechar = None

    one-character stringto quote fields containing special characters

  quotechar = '"'

    control how instances of quotechar in a field are quoted

  quoting = 0

    control when quotes are recognized by the reader

  skipinitialspace = True

    ignore whitespace immediately following the delimiter

  Methods Documentation

  __call__(lines)

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

    Parameters:
      lines `python:list`

        List of table lines

    Yields:
      line `python:list` of `python:str`

        Each line’s split values.

  join(vals)
  process_line(line)

    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

  process_val(val)

    Remove whitespace at the beginning or end of value.