Valerio Pachera wrote: [Me:]
>> def merge_lines(lines): >> lines = (line.rstrip("\n") for line in lines) >> accu = [next(lines)] >> for line in lines: >> if line.startswith(" "): >> accu.append(line[1:]) >> else: >> yield "".join(accu) + "\n" >> accu = [line] >> yield "".join(accu) + "\n" > I think it could be solved in a much easier way. > content=f.read().replace('\n ', '') That is indeed much simpler than my suggestion. > What am I missing? Nothing. My attempt to keep memory usage low led to a solution which is more complex than your slurp-it-in, fix it, spit-it-out. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor