f = open("1.log", 'r')f1 = open("2.txt",'w')for i in f: if "qSrcAddr=180.163.194.15" in i: f1.write(i) print(i)f.close()f1.close()