load_in_list

yoda_powers.toolbox.load_in_list(filename)[source]

Check file exist and create generator with no line break file can be a gzip file with ‘.gz’ extension

Notes

function need modules:

  • pathlib

Parameters

filename (str) – a path to existent file

Yields

str – generator of rows without line break

Raises

FileNotFoundError – If file filename does not exist or not valide file

Example

>>> rows = load_in_list("filename")
>>> list(rows)
["i like pears, but apples scare me","i like apples, but pears scare me","End of file"]