PSCF v1.1
|
Utilities for manipulating and searching text strings. More...
Classes | |
class | FileEditor |
Class to substitute text in one or more files. More... | |
class | Grep |
Class to search for text in a file. More... | |
class | Record |
A Record represents a string of fields separated by whitespace. More... | |
class | RecordEditor |
Class to modify selected Records in a file of records. More... | |
class | Wrapper |
Class to wrap line breaks. More... | |
Functions | |
def | readLabelledLine (file, label) |
Read a line of the form "label = string", return string. More... | |
def | readLabelledList (file, label) |
Read line of form "label = string", in which string may contains spaces. More... | |
Utilities for manipulating and searching text strings.
def pscfpp.text.readLabelledLine | ( | file, | |
label | |||
) |
Read a line of the form "label = string", return string.
This function reads a line of the form "label = <string>" containing a known label, an equal sign, and a string following the label. The must match a known label that is passed as a parameter. If the label does not match (failure), this function prints an error and returns. If the label does match (success), this function returns the remaining string verbatim, stripped of any preceding and trailing white space.
file | open for reading, with cursor at beginning of a line |
label | expected label (must match) |
Definition at line 232 of file text.py.
Referenced by pscfpp.text.readLabelledList().
def pscfpp.text.readLabelledList | ( | file, | |
label | |||
) |
Read line of form "label = string", in which string may contains spaces.
This function reads a line of the form "label = <string>" containing a known label, an equal sign, and a string following the label, in which the string may contain sub-strings spaces. The label must match a known label that is passed as a function parameter. If the label function does not match, this function prints an error and exits. If the label matches (success), this function returns a list of sub-strings separated by spaces. For example, if the string after the equal sign is 'a b c', the function returns a list ['a', 'b', 'c'].
file | open for reading, with cursor at beginning of a line |
label | expected label (must match) |
Definition at line 263 of file text.py.
References pscfpp.text.readLabelledLine().
Referenced by pscfpp.make.MakeMaker.__init__().