TextFile#

class pyopenms.TextFile#

Bases: object

OpenMS class TextFile

__init__() → None#
__init__(arg: pyopenms.TextFile, /) → None
__init__(filename: str, trim_lines: bool = False, first_n: int = -1, skip_empty_lines: bool = False, comment_symbol: str = '') → None

Methods

__init__()

addLine(line)

Appends a line to the internal buffer

load(filename[, trim_lines, first_n, ...])

Loads data from a text file

store(filename)

Writes the data to a file

addLine(line: str) → None#

Appends a line to the internal buffer

load(filename: str, trim_lines: bool = False, first_n: int = -1, skip_empty_lines: bool = False, comment_symbol: str = '') → None#

Loads data from a text file

Parameters:
  • filename – The input file name

  • trim_lines – Whether or not the lines are trimmed when reading them from file

  • first_n – If set, only first_n lines the lines from the beginning of the file are read

  • skip_empty_lines – Should empty lines be skipped? If used in conjunction with trim_lines, also lines with only whitespace will be skipped. Skipped lines do not count towards the total number of read lines

store(filename: str) → None#

Writes the data to a file