use ```for i in [idx for idx, a in enumerate(a_s) if not a.endswith('\n')]```