PyNeb  1.1.2
PyNeb Reference Manua
FortranLine Class Reference

Public Member Functions

def __init__
def __len__ (self)
def __getitem__ (self, i)
def __getslice__ (self, i, j)
def __str__ (self)
def isBlank (self)

Public Attributes


Detailed Description

Fortran-style record in formatted files

FortranLine objects represent the content of one record of a
Fortran-style formatted file. Indexing yields the contents as
Python objects, whereas transformation to a string (using the
built-in function 'str') yields the text representation.


  1. Only A, D, E, F, G, I, and X formats are supported (plus string
     constants for output).

  2. No direct support for complex numbers; they must be split into
     real and imaginary parts before output.

  3. No overflow check. If an output field gets too large, it will
     take more space, instead of being replaced by stars according
     to Fortran conventions.

Constructor & Destructor Documentation

def __init__ (   self,
  length = 80 
@param data: either a sequence of Python objects, or a string
     formatted according to Fortran rules

@param format_: either a Fortran-style format string, or a
       L{FortranFormat} object. A FortranFormat should
       be used when the same format string is used repeatedly,
       because then the rather slow parsing of the string
       is performed only once.

@param length: the length of the Fortran record. This is relevant
       only when data is a string; this string is then
       extended by spaces to have the indicated length.
       The default value of 80 is almost always correct.

Member Function Documentation

def __getitem__ (   self,
@param i: index
@type i: C{int}
@returns: the ith data element
def __getslice__ (   self,
@param i: start index
@type i: C{int}
@param j: end index
@type j: C{int}
@returns: a list containing the ith to jth data elements
def __len__ (   self)
@returns: the number of data elements in the record
@rtype: C{int}
def __str__ (   self)
@returns: a Fortran-formatted text representation of the data record
@rtype: C{str}
def isBlank (   self)
@returns: C{True} if the line contains only whitespace
@rtype: C{bool}

Member Data Documentation