astro py:docs

- Index
- Modules

### Navigation

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

# FixedWidth

class `astropy.io.ascii.fixedwidth.``FixedWidth`(col_starts=None, col_ends=None, delimiter_pad=' ', bookend=True)

  Bases: `astropy.io.ascii.core.BaseReader`

  Read or write a fixed width table with a single header line that defines column names and positions. Examples:

      # Bar delimiter in header and data

      |  Col1 |   Col2      |  Col3 |
      |  1.2  | hello there |     3 |
      |  2.4  | many words  |     7 |

      # Bar delimiter in header only

      Col1 |   Col2      | Col3
      1.2    hello there    3
      2.4    many words     7

      # No delimiter with column positions specified as input

      Col1       Col2Col3
       1.2hello there   3
       2.4many words    7

  See the Fixed-width Gallery for specific usage examples.

  Parameters:

  - col_starts – list of start positions for each column (0-based counting)
  - col_ends – list of end positions (inclusive) for each column
  - delimiter_pad – padding around delimiter when writing (default = None)
  - bookend – put the delimiter at start and end of line when writing (default = False)