mirror of
https://github.com/iluvcapra/mfbatch.git
synced 2025-12-31 08:50:51 +00:00
21 lines
359 B
Python
21 lines
359 B
Python
# util.py
|
|
|
|
def readline_with_escaped_newlines(f):
|
|
line = ''
|
|
while True:
|
|
line += f.readline()
|
|
|
|
if len(line) == 0:
|
|
break
|
|
|
|
line = line.rstrip("\n")
|
|
|
|
if len(line) > 0 and line[-1] == '\\':
|
|
line = line[:-1]
|
|
continue
|
|
|
|
else:
|
|
yield line
|
|
line = ''
|
|
|