Menu

#54 Allow line continuations @asserts

open
nobody
None
5
2016-06-24
2016-06-24
Elizabeth F
No

Python parser needs to understand free-format Fortran line continuations.

[6/24/16, 4:25:19 PM] Elizabeth F: def continuation_lines(fin):
for line in fin:
line = line.rstrip('\n')
while line.endswith('\'):
line = line[:-1] + next(fin).rstrip('\n')
yield line

with open("long.txt") as fin:
for line in continuation_lines(fin):
...

Discussion


Log in to post a comment.

MongoDB Logo MongoDB