I have a Two text files ,names are one.txt and two.txt In one.txt , contents are
AAA
BBB
CCC
DDD
In two.txt , contents are
DDD
EEE
I want a python code to determine a contains of two.txt are present in one.txt or not If present means, don't do anything, But if contents of two.txt are not present means,it should append to one.txt
I want a output in one.txt as
AAA
BBB
CCC
DDD
EEE
Code:
file1 = open("file1.txt", "r")
file2 = open("file2.txt", "r")
file3 = open("resultss.txt", "w")
list1 = file1.readlines()
list2 = file2.readlines()
file3.write("here: \n")
for i in list1: for j in list2:
if i==j: file3.write(i)