Skip to content

Data

TextList

Bases: ItemList

Build a text list from list of files in the path end with extensions, optionally recursively.

from_files(path, extensions='.txt', include=None, recurse=True, tfms=None, encoding='utf8') classmethod

Parameters:

Name Type Description Default
path str | Path

Path for the root directory to search for files.

required
extensions str | Iterable[str] | None

Suffixes of filenames to look for.

IMAGE_EXTENSIONS
include Iterable[str] | None

Top-level Director(y|ies) under path to use to search for files.

None
recurse bool

Whether to search subdirectories recursively.

True
tfms Callable | None

Transformations to apply items before returning them.

None
encoding str

Name of encoding used to decode files.

utf8

get(i)

Returns text in the file as string if i is path to a file.