astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- ASCII Tables (`astropy.io.ascii`) »
- BaseSplitter

# BaseSplitter

class `astropy.io.ascii.core.``BaseSplitter`

  Bases: `object`

  Base splitter that uses python’s split method to do the work.

  This does not handle quoted values. A key feature is the formulation of __call__ as a generator that returns a list of the split line values at each iteration.

  There are two methods that are intended to be overridden, first `process_line()` to do pre-processing on each input line before splitting and `process_val()` to do post-processing on each split string value. By default these apply the string `strip()` function. These can be set to another function via the instance attribute or be disabled entirely, for example:

      reader.header.splitter.process_val = lambda x: x.lstrip()
      reader.data.splitter.process_val = None

  Parameters: | delimiter – one-character string used to separate fields

  Attributes Summary

  `delimiter` |

  Methods Summary

  `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

  `delimiter` = None

  Methods Documentation

  `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.

  `process_val`(val)

    Remove whitespace at the beginning or end of value.