load_in_list_col

yoda_powers.toolbox.load_in_list_col(filename, col=0, sep='\t')[source]

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

Parameters
  • filename (str) – a path to existent file

  • col (int, default) – the selected column (python index). Default=0

  • sep (str, default) – the string separator. Default=” “

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_col("filename", col=1, sep=";")
>>> list(rows)
["i like pears, but apples scare me","i like apples, but pears scare me","End of file"]