KwabsHug commited on
Commit
b910e0e
1 Parent(s): ba25c70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -198,12 +198,12 @@ def merge_lines(doc1, doc2, doc3, doc4):
198
  docs = [doc1, doc2, doc3, doc4]
199
  merged_lines = []
200
 
201
- with open("merged_lines.txt", "w") as f:
202
- with [open(doc) for doc in docs] as handles:
203
- for lines in zip(*handles):
204
- merged_line = "".join(line.strip() for line in lines)
205
- f.write(merged_line + "\n")
206
- merged_lines.append(merged_line)
207
 
208
  return merged_lines
209
 
 
198
  docs = [doc1, doc2, doc3, doc4]
199
  merged_lines = []
200
 
201
+ with open("merged_lines.txt", "w") as f, \
202
+ *map(open, docs) as handles:
203
+ for lines in zip(*handles):
204
+ merged_line = "".join(line.strip() for line in lines)
205
+ f.write(merged_line + "\n")
206
+ merged_lines.append(merged_line)
207
 
208
  return merged_lines
209