def space_list ( line : str ) -> List [ int ] : spaces = [ ] for idx , car in enumerate ( list ( line ) ) : if car == " " : spaces . append ( idx ) return spaces
python list of indexes for each newline in string
Given a string return a list of index positions where a blank space occurs .
def space_list(line: str) -> List[int]:
    """
    Given a string, return a list of index positions where a blank space occurs.

    :param line:
    :return:

    >>> space_list("    abc ")
    [0, 1, 2, 3, 7]
    """
    spaces = []
    for idx, car in enumerate(list(line)):
        if car == " ":
            spaces.append(idx)
    return spaces