dctools.utilities.file_utils.read_file_tolist

dctools.utilities.file_utils.read_file_tolist(filepath, max_lines=0)

Read a file and return its content as a list of strings (lines).

Parameters:
  • filepath (str) – Path to the file.

  • max_lines (int, optional) – Maximum number of lines to read. Defaults to 0 (read all).

Returns:

List of lines stripped of whitespace.

Return type:

List[str]