TextFile

class pyopenms.TextFile

Bases: object

Cython implementation of _TextFile

Original C++ documentation is available here

__init__()

Overload:

__init__(self) None

This class provides some basic file handling methods for text files

Overload:

__init__(self, in_0: TextFile) None

Overload:

__init__(self, filename: Union[bytes, str, String], trim_linesalse: bool, first_n1: int) None

Methods

__init__

Overload:

addLine(self, line)

load(self, filename, trim_linesalse, first_n1)

Loads data from a text file

store(self, filename)

Writes the data to a file

addLine(self, line: Union[bytes, str, String]) None
load(self, filename: Union[bytes, str, String], trim_linesalse: bool, first_n1: int) 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(self, filename: Union[bytes, str, String]) None

Writes the data to a file