Categories
python generator?
How to use a generator in python to merge files?
Answer the question
In order to leave comments, you need to log in
def test(f1, f2): with open(f1, 'r') as fd: for i in fd.xreadlines(): yield i with open(f2, 'r') as fd: for i in fd.xreadlines(): yield i for i in test("file1", "file2"): print i
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question