fp1 = open("temp1.txt", "r") fp2 = open("temp2.txt", "r") while True: try: x = next(fp1) y = next(fp2) except StopIteration: break
参考文献:
http://www.runoob.com/python/python-func-next.html