Package chianti :: Package fortranformat :: Module FortranRecordReader' :: Class FortranRecordReader
[hide private]
[frames] | no frames]

Class FortranRecordReader

source code

object --+
         |
        FortranRecordReader

Generate a reader object for FORTRAN format strings

Typical use case ...

>>> header_line = FortranRecordReader('(A15, A15, A15)')
>>> header_line.read('              x              y              z')
['              x', '              y', '              z']
>>> line = FortranRecordReader('(3F15.3)')
>>> line.read('          1.000          0.000          0.500')
[1.0, 0.0, 0.5]
>>> line.read('          1.100          0.100          0.600')
[1.1, 0.1, 0.6]

Note: it is best to create a new object for each format, changing the format causes the parser to reevalute the format string which is costly in terms of performance

Instance Methods [hide private]
 
__eq__(self, other) source code
 
__init__(self, format)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_parse_format(self) source code
 
get_format(self) source code
 
match(self, record) source code
 
read(self, record)
Pass a string representing a FORTRAN record to obtain the relevent values
source code
 
set_format(self, format) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  format

Inherited from object: __class__

Method Details [hide private]

__init__(self, format)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

Property Details [hide private]

format

Get Method:
get_format(self)
Set Method:
set_format(self, format)