I have 5 files as follows
F1:
ABL1
ABR
AHSG
AIRE
CCKBR
LRBA
CDC27
CENPA
F2:
AKT1
APC
APP
AR
CCND1
C11ORF2
CCNE1
CST6
CTNNB1
DBI
DEFA1
DNMT1
EEF1A1
EEF1G
F3:
ACTG1
AMPH
ANK3
APBA2
APOA1
ARHGDIA
ATP5J
DST
CA1
CA12
DDR1
CALR
CASP6
F4:
ACVR1
ARL4D
RHOA
RHOG
RHOH
BMPR1B
BMPR2
CDC20
CDK4
CDK6
CHN1
F5:
A1BG
A2M
AAMP
ACTB
ADD1
ALAS1
ALB
APLP1
ASNA1
ATP5B
I tried following code
file1=open("F1.txt","r")
file2=open("F2.txt","r")
file3=open("F3.txt","r")
file4=open("F4.txt","r")
file5=open("F5.txt","r")list1=file1.readlines()
list2=file2.readlines()
list3=file3.readlines()
list4=file4.readlines()
list5=file5.readlines()for line1 in list1:for line2 in list2:for line3 in list3:for line3 in list4:for line4 in list5:if line1.strip() in line2.strip() in line3.strip() in line4.strip() in line5.strip():print line1file3.write(line1)
Now I want to compare all this files and find out common words using python script Can anybody help? Can I use sets?