KwabsHug commited on
Commit
fb38229
1 Parent(s): fb318c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -198,10 +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, *map(open, docs) as handles:
202
- for lines in zip(*handles):
 
 
203
  merged_line = "".join(line.strip() for line in lines)
204
- f.write(merged_line + "\n")
205
  merged_lines.append(merged_line)
206
 
207
  return merged_lines
 
198
  docs = [doc1, doc2, doc3, doc4]
199
  merged_lines = []
200
 
201
+ with open(doc1, "r") as f1, open(doc2, "r") as f2, \
202
+ open(doc3, "r") as f3, open(doc4, "r") as f4, \
203
+ open("merged_lines.txt", "w") as f_out:
204
+ for lines in zip(f1, f2, f3, f4):
205
  merged_line = "".join(line.strip() for line in lines)
206
+ f_out.write(merged_line + "\n")
207
  merged_lines.append(merged_line)
208
 
209
  return merged_lines